Skip to content
Signals & connectionsOverview

Signal.Once

Registers a one-time callback on a local Signal object.

Details#

Subscribes a callback that disconnects itself on its first invocation. Returns the connection, allowing cancellation before the event fires.

Examples#

Example

Luau
local signal = Signal.new()
local connection = signal:Once(function(value) print(value) end)
signal:Fire("first")
task.defer(function() connection:Disconnect() end)