EventConnection
EventConnection manages the connection between an event and its callback function. Returned when calling Event:Connect(), allowing you to later disconnect the callback.
Use EventConnection to:
- Stop listening to events when no longer needed
- Clean up connections to prevent memory leaks
- Conditionally enable/disable event handlers
Methods
Disconnects the callback from the event. After calling this, the callback will no longer be invoked when the event fires.
local connection = event:Connect(function()
print("Event fired")
end)
-- Disconnect when done
connection:Disconnect()
Returns
void
Updated 13 days ago