Connect
Subscribes to the signal and returns a connection object with :Disconnect(), :Disable(), :Enable() and .Connected.
Syntax
:Connect(fn: function) -> table
Parameters
| Parameter | Type | Description |
|---|---|---|
fn | function | The function or callback to use. |
Returns
| Type | Description |
|---|---|
table | A connection object with :Disconnect(), :Disable(), :Enable() and a .Connected flag |
Description
Connect is part of the Signals library. Signals in the VM share the RBXScriptSignal API and are pumped from the external tick loop.
The callback is registered immediately and remains subscribed until the returned connection is disconnected.
:Disable() keeps the connection alive but stops invoking the callback; :Enable() resumes it. .Connected stays true while a connection is disabled and turns false after :Disconnect().
Example
local conn = workspace.ChildAdded:Connect(function(child)
print(child.Name)
end)
conn:Disable()
print(conn.Connected) -- true
conn:Enable()
conn:Disconnect()
Notes
- Signals share the RBXScriptSignal API across the VM.
- Disable/Enable only affect firing; the callback stays registered.
Once(fn)connections fire a single time and are cleaned up automatically.