Owl.Util.ListenerGroup.new(): ListenerGroup

Server & Client

Creates a new, empty ListenerGroup -- a standalone utility (not Replica-specific) for batching several disconnect functions so they can all be torn down in one call. Common use case: a character dies and every UI listener bound to it should be released at once to free memory.

Returns

ListenerGroupA new ListenerGroup instance.
local group = Owl.Util.ListenerGroup.new()
 
group:Add(replica:ListenToChange({"Health"}, onHealthChanged))
group:Add(replica:ListenToFullChange(onAnyChange))
 
humanoid.Died:Connect(function()
    group:DisconnectAll()
end)