Signal: Connect Synchronous
KawaiiSignal:ConnectPsmSignal:ConnectVoltSignal:Connect
Subscribe a callback to a custom Signal. Each Fire call sends its arguments to the callback until the returned connection is disconnected.
Luau
Signal:Connect(callback: Function) -> SignalConnectionParameters
Call this method with a Signal receiver. The colon supplies self implicitly; a dot call must pass the receiver explicitly.
| Parameter | Type | Description |
|---|---|---|
callback | Function | Function that receives the arguments passed to Fire. |
Returns
SignalConnectionA SignalConnection with Connected and Disconnect.
Luau
SignalConnection = {Connected: boolean, Disconnect: Function}Usage notes
Keep the returned connection when you need to stop listening independently of other subscribers. Callbacks run synchronously during Fire.
Example
Luau
local updates = Signal.new()
local subscription = updates:Connect(function(count)
print("Count:", count)
end)
updates:Fire(1)
subscription:Disconnect()
updates:Destroy()