Signal:Once Synchronous

  • KawaiiSignal:Once
  • PsmSignal:Once
  • VoltSignal:Once

Subscribe a callback for just the next firing of a custom Signal. The listener disconnects before its callback runs.

Syntax
Luau
Signal:Once(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 that receives the arguments from the next Fire.

Returns

SignalConnection

A SignalConnection; you can disconnect it before the event arrives.

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

Usage notes

Use Once for a one-time transition such as initialization completion. Repeated Fire calls do not invoke this callback again.

Example

Example
Luau
local ready = Signal.new()
ready:Once(function(value) print("First:", value) end)
ready:Fire("loaded")
ready:Fire("ignored by Once")
ready:Destroy()
Kawaii documentation