getconnections Synchronous

  • get_signal_cons

Inspect the live listeners attached to a Roblox event. This is useful when tracing why an event fires more than once or temporarily controlling a particular listener.

Syntax
Luau
getconnections(signal: RBXScriptSignal) -> {Connection}

Parameters

Function parameters
ParameterTypeDescription
signalRBXScriptSignalRBXScriptSignal whose listeners you want to inspect.

Returns

{Connection}

An array of Connection objects. Each object exposes Enabled, Fire, Defer, Disconnect, Disable, and Enable.

Connection fields
Luau
Connection = {
  Enabled: boolean, ForeignState: boolean, LuaConnection: boolean,
  Function: Function?, Thread: thread?
}

Usage notes

The array describes connections present when the function runs. It does not include callbacks attached later. A Connection object controls its original listener, so be careful when disabling game-owned callbacks.

Function and Thread come from live callback slots in the current VM. For listeners owned by another VM, those fields can be nil even though the connection is present.

Example

Example
Luau
local signal = game:GetService("Players").PlayerAdded
for index, connection in ipairs(getconnections(signal)) do
    print(index, connection.Enabled)
end