RBXScriptConnection

Constructors

NameDescription
RBXScriptSignal:Connect(func: function):RBXScriptConnectionReturned by calling :Connect() (or :Once() / :ConnectParallel()) on an RBXScriptSignal, such as an Instance's event property - RBXScriptConnection has no direct constructor of its own.

Code Snippet

local part = workspace.Part

local connection = part.Touched:Connect(function(hit)
    print(hit.Name, "touched the part")
end)

task.wait(5)
connection:Disconnect()
print("Still connected:", connection.Connected)

Properties

NameTypeDescription
ConnectedbooleanWhether the connection is still active. Becomes false once Disconnect() is called on it.

Methods

NameParametersReturnsDescription
Disconnect()VoidVoidDisconnects the connection from its event, so the connected function will no longer be called when the event fires.