Signal: Connect Synchronous
KawaiiSignal:ConnectPsmSignal:ConnectVoltSignal:Connect
Register a callback that receives the arguments supplied to this signal’s Fire method. Use it for ongoing subscriptions such as updating a preview after each settings change. Connecting registers the function; it does not immediately call it.
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 called with the event arguments whenever the signal fires. |
Returns
SignalConnectionA SignalConnection with a Connected flag and a Disconnect method.
Luau
SignalConnection = {Connected: boolean, Disconnect: Function}Usage notes
Keep the connection if you need to stop listening before the signal is destroyed.
Example
Luau
local changed = Signal.new()
local listener = changed:Connect(function(theme)
print("Preview theme:", theme)
end)
changed:Fire("dark")
changed:Fire("light")
listener:Disconnect()
changed:Destroy()