Hand-written by Joseph San Nicolas, Roblox Developer
RBXScriptConnection
Constructors
| Name | Description |
| RBXScriptSignal:Connect(func: function):RBXScriptConnection | Returned 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
| Name | Type | Description |
| Connected | boolean | Whether the connection is still active. Becomes false once Disconnect() is called on it. |
Methods
| Name | Parameters | Returns | Description |
| Disconnect() | Void | Void | Disconnects the connection from its event, so the connected function will no longer be called when the event fires. |