• Studio

  • Studio API

  • Bots

  • Web API

  • Designer Resources

  • Host Resources

  • Globals

    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

    Disconnect

    ClientAndServer

    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

    PocketWorlds Icon

    © 2025 Pocket Worlds. All rights reserved.