Signal:Connect Synchronous

  • KawaiiSignal:Connect
  • PsmSignal:Connect
  • VoltSignal: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.

Syntax
Luau
Signal:Connect(callback: Function) -> SignalConnection

Parameters

Call this method with a Signal receiver. The colon supplies self implicitly; a dot call must pass the receiver explicitly.

Function parameters
ParameterTypeDescription
callbackFunctionFunction called with the event arguments whenever the signal fires.

Returns

SignalConnection

A SignalConnection with a Connected flag and a Disconnect method.

SignalConnection fields
Luau
SignalConnection = {Connected: boolean, Disconnect: Function}

Usage notes

Keep the connection if you need to stop listening before the signal is destroyed.

Example

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()
Kawaii documentation