evasivedocs
Roblox scriptingLuau 0.748 · 24 guides · 385 API entries
API reference

Signals

Events and their connections.

RBXScriptSignal

An event: RunService.Heartbeat, Players.PlayerAdded, ... Handlers run as threads of the script that connected them and stop with it.

3 entries

RBXScriptSignal:Connect

method
RBXScriptSignal:Connect(handler) -> RBXScriptConnection

Calls handler with the signal's arguments every time it fires.

Arguments
NameTypeDescription
handlerfunction
Returns
  • RBXScriptConnection
Example
Luau
local conn = RunService.Heartbeat:Connect(function(dt) end)

RBXScriptSignal:Once

method
RBXScriptSignal:Once(handler) -> RBXScriptConnection

Like Connect, for the next firing only.

Arguments
NameTypeDescription
handlerfunction
Returns
  • RBXScriptConnection

RBXScriptSignal:Wait

method
RBXScriptSignal:Wait() -> ...any

Yields until the signal fires and returns its arguments.

Returns
  • ...any
Example
Luau
local char = player.CharacterAdded:Wait()

RBXScriptConnection

What Connect returns.

2 entries

RBXScriptConnection:Disconnect

method
RBXScriptConnection:Disconnect()

Stops calling the handler.

Example
Luau
conn:Disconnect()

RBXScriptConnection.Connected

field

false once disconnected.

Returns
  • boolean