Roblox UtilitiesDevlHub Roblox Documentation

Data type

RBXScriptConnection

A connection between an RBXScriptSignal and a function.

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.

Luau
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 1#

ConnectedboolThe state of the RBXScriptConnection.

Connected: bool#

Describes whether or not the connection is still alive. This becomes false if Disconnect() is called.

Methods 1#

DisconnectDisconnects the connection from the event.

Disconnect(): ()#

Disconnects the connection from the event.

Returns
  • ()