Signal.new Synchronous

  • KawaiiSignal.new
  • PsmSignal.new
  • VoltSignal.new

Create a custom Luau signal for passing events between parts of a script. Use a custom signal to keep a producer, such as a settings editor, independent from the code that reacts to its changes. Save connections so listeners can be removed when their UI closes.

Syntax
Luau
Signal.new() -> Signal

Parameters

This function takes no arguments.

Returns

Signal

A Signal object with Connect, Once, Wait, Fire, DisconnectAll, and Destroy methods.

Usage notes

Signal, KawaiiSignal, VoltSignal, and PsmSignal refer to the same library.

Example

Example
Luau
local changed = Signal.new()
local connection = changed:Connect(function(value)
    print("Changed:", value)
end)
changed:Fire("dark")
connection:Disconnect()
changed:Destroy()
Kawaii documentation