getconnection Synchronous

Pick one listener from getconnections without indexing the returned array yourself. Use it when you already know which connection position you need.

Syntax
Luau
getconnection(signal: RBXScriptSignal, index: number) -> Connection?

Parameters

Function parameters
ParameterTypeDescription
signalRBXScriptSignalRBXScriptSignal to inspect.
indexnumberOne-based position in the current getconnections result.

Returns

Connection?

The Connection at that position, or nil when the position is absent.

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

Usage notes

This is a convenience wrapper around getconnections. Listener order may change as scripts connect or disconnect, so do not store an index as a permanent identifier.

Example

Example
Luau
local signal = game:GetService("Players").PlayerAdded
local first = getconnection(signal, 1)
if first then print("First listener enabled:", first.Enabled) end
Kawaii documentation