RBXScriptConnection

Show Deprecated

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 : BasePart = script.Parent
-- Store reference to the RBXScriptConnection so it can be disconnected later
local connection : RBXScriptConnection = part.Touched:Connect(function(otherPart)
print("Hello world!")
end)
-- Wait 15 seconds, then disconnect
task.wait(15)
connection:Disconnect()

Summary

Properties

Methods

  • Disconnect():void

    Disconnects the connection from the event.

Properties

Connected

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

Methods

Disconnect

void

Disconnects the connection from the event.

Returns

void