Connection
Represents a connection object obtained from instances.getconnections.
This object provides detailed information about a single connection to an RBXScriptSignal and allows manipulating it.
Connection objects can be compared with each other using the equality operator (==). Internally, this checks if they represent the same underlying connection slot.
Properties
ForeignState
This item is read only and cannot be modified. Read OnlyConnection.ForeignState: booleanA boolean indicating if the connection belongs to a different Luau Virtual Machine (e.g., an Actor thread) or is a C function connection.
Function
This item is read only and cannot be modified. Read OnlyConnection.Function: ((...any) → ...any)?The Luau function associated with this connection. Returns nil if ForeignState is true.
Enabled
Connection.Enabled: booleanA boolean indicating if the connection is currently enabled. Setting this to false is equivalent to calling Disable, setting it to true is equivalent to calling Enable.
LuaConnection
This item is read only and cannot be modified. Read OnlyConnection.LuaConnection: booleanA boolean indicating if this is a connection to a Luau function (as opposed to a C function).
Thread
This item is read only and cannot be modified. Read OnlyConnection.Thread: thread?The Luau thread (coroutine) this connection belongs to. Returns nil if ForeignState is true.
IsOnce
This item is read only and cannot be modified. Read OnlyConnection.IsOnce: booleanA boolean indicating if this connection was created using ConnectOnce. Such connections automatically disconnect after firing once.
Functions
Disconnect
Connection:Disconnect() → ()Disconnects the signal connection. After calling this, the Connection object becomes unusable and attempting to access its properties or methods will error.
Enable
Connection:Enable() → ()Enables the connection if it was previously disabled.
Disable
Connection:Disable() → ()Disables the connection without disconnecting it. The connection can be re-enabled later using Enable or by setting the Enabled property to true.
Fire
Connection:Fire(...: any--
Arguments to pass to the connected function.
) → ()Fires the connected function immediately with the provided arguments. Does nothing if ForeignState is true. If IsOnce is true, the connection will be disconnected after firing.
Defer
Connection:Defer(...: any--
Arguments to pass to the connected function when deferred.
) → ()Schedules the connected function to be executed later (deferred) with the provided arguments via task.defer. Does nothing if ForeignState is true. If IsOnce is true, the connection will be disconnected after firing.