getconnection Synchronous
Pick one listener from getconnections without indexing the returned array yourself. Use it when you already know which connection position you need.
Luau
getconnection(signal: RBXScriptSignal, index: number) -> Connection?Parameters
| Parameter | Type | Description |
|---|---|---|
signal | RBXScriptSignal | RBXScriptSignal to inspect. |
index | number | One-based position in the current getconnections result. |
Returns
Connection?The Connection at that position, or nil when the position is absent.
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
Luau
local signal = game:GetService("Players").PlayerAdded
local first = getconnection(signal, 1)
if first then print("First listener enabled:", first.Enabled) end