Source: Roblox Creator Hub · CC BY 4.0 · View source · Code samples: MIT Imported 2026-10-03. Formatting adapted for this site.
RBXScriptConnection
The RBXScriptConnection data type is a special object returned by the Connect() method of an event (RBXScriptSignal). This is used primarily to disconnect a listener from an RBXScriptSignal.
local part = Instance.new("Part")
-- Store reference to the RBXScriptConnection so it can be disconnected later
local connection : RBXScriptConnection = part.Touched:Connect(function(otherPart)
print("Hello world!")
end)
-- Disconnect when the connection is no longer needed
connection:Disconnect() Properties
| Name | Type / Returns | Description |
|---|---|---|
| RBXScriptConnection.Connected | bool | The state of the RBXScriptConnection. |
RBXScriptConnection.Connected
Describes whether or not the connection is still alive. This becomes false if Disconnect() is called.
| Field | Value |
|---|---|
| type | bool |
Methods
| Name | Type / Returns | Description |
|---|---|---|
| RBXScriptConnection:Disconnect | () | Disconnects the connection from the event. |
RBXScriptConnection:Disconnect
Disconnects the connection from the event.
Returns
| Type | Description |
|---|---|
| () |