Skip to content
Saiko

Signal.new

Creates a signal of your own, one you can connect to, wait on and fire from Luau.

Signature

luau
Signal.new(): Signal

Returns

Signal

Note

Example

luau
local signal = Signal.new()

local connection = signal:Connect(function(name, count)
    print("fired with", name, count) --> fired with hello 3
end)

signal:Fire("hello", 3)

connection:Disconnect()
signal:Fire("ignored") -- nothing is printed

signal:Once(function()
    print("only the first time")
end)
signal:Fire()
signal:Fire()

task.delay(0.1, function()
    signal:Fire("done")
end)
print(signal:Wait()) --> done