Volt

getconnections

Gets all connections to a signal.

Syntax

getconnections(signal: RBXScriptSignal) -> {Connection}

Parameters

ParameterTypeDescription
signalRBXScriptSignalThe signal

Returns

TypeDescription
{Connection}Array of Connection objects

Description

getconnections returns all current connections to a signal, allowing you to inspect, fire, disable, or disconnect them individually.

Example

local connections = getconnections(game.Players.PlayerAdded)

print("Total connections:", #connections)

for i, conn in ipairs(connections) do
    print(i, "Enabled:", conn.Enabled)
end

Disconnecting All

local function disconnectAll(signal)
    for _, conn in ipairs(getconnections(signal)) do
        conn:Disconnect()
    end
end

-- Disconnect all PlayerAdded handlers
disconnectAll(game.Players.PlayerAdded)

Disabling Specific Connections

local connections = getconnections(workspace.Part.Touched)

for _, conn in ipairs(connections) do
    if conn.Function then
        -- Check if it's the function we want to disable
        conn:Disable()
    end
end

Inspecting Connection Functions

local connections = getconnections(someEvent)

for _, conn in ipairs(connections) do
    if conn.LuaConnection and conn.Function then
        print("Found Lua connection")
        local constants = debug.getconstants(conn.Function)
        print("Constants:", table.concat(constants, ", "))
    end
end

The Connection Object

Each connection returned has the following properties and methods:

Property/MethodTypeDescription
EnabledbooleanWhether the connection is active
ForeignStatebooleanWhether it's from a different Luau state
LuaConnectionbooleanWhether it's a Lua connection
FunctionfunctionThe connected function (if accessible)
ThreadthreadThe connection's thread
Fire(...)methodFire this connection only
Defer(...)methodDeferred fire
Disconnect()methodDisconnect this connection
Disable()methodTemporarily disable
Enable()methodRe-enable after disable

On this page