Skip to content

Commit

Permalink
Fix topic not being cleared if no active listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
IconPippi committed Apr 19, 2023
1 parent 79cf43a commit 809d83e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plugin/init.server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,12 @@ game:GetService("RunService").Heartbeat:Connect(function()
for i, topic in ipairs(subscribedTopics) do
local data = plugin:GetSetting(topic)
if data then
-- we want to clear the setting field even if there's
-- no one subscribed to this topic ready to accept the data
plugin:SetSetting(topic, nil)

local callback: BindableEvent = MMS:WaitForChild(topic .. "_CallbackEvent")
callback:Fire(data)
plugin:SetSetting(topic, nil)
end
end
end)

0 comments on commit 809d83e

Please sign in to comment.