Glorpia Docs
Scripting / Events

Signals & Connect()

Subscribe a Luau function to a Glorpia event and disconnect the connection when needed.

Connect

signal:Connect(callback)
NameTypeDescription
callbackfunctionFunction called whenever the signal fires.
returnconnectionConnection object for checking or disconnecting the subscription.

Studio autocomplete

When Studio knows that a member is a signal, autocomplete inserts the signal name together with :Connect() and places the caret inside the parentheses. This includes Touched and the TextButton signals Activated, MouseButton1Click, MouseButton1Down and MouseButton1Up.

Connection

NameTypeDescription
ConnectedbooleanTrue while the callback is still registered.
Disconnect()methodRemoves the callback from the signal.

Example: Connect And Disconnect

Luau
local RunService = game:GetService("RunService")
local elapsed = 0

local connection
connection = RunService.Heartbeat:Connect(function(deltaTime)
    elapsed = elapsed + deltaTime

    if elapsed >= 5 then
        connection:Disconnect()
    end
end)
A callback is allowed to disconnect itself while the signal is firing.

Documented signals