Signals
All signals in the VM (RunService, UserInputService, instance events, tween Completed…) share the RBXScriptSignal API.
Subscribes to the signal and returns a connection object with :Disconnect(), :Disable(), :Enable() and a .Connected flag.
workspace.ChildAdded:Connect(function(child)
print(child.Name)
end)
Returns the live connection objects subscribed to a signal, including disabled ones.
for _, conn in ipairs(getconnections(workspace.ChildAdded)) do
conn:Disable()
end
Subscribes for a single fire.
workspace.ChildAdded:Once(function(child)
print("first child:", child.Name)
end)
Yields until the signal fires and returns the fired arguments.
local child = workspace.ChildAdded:Wait()
print(child.Name)
Fires the signal manually, useful for BindableEvent-style patterns. firesignal(signal, ...) is the equivalent global helper.
local event = Instance.new("BindableEvent")
event.Event:Connect(function(value)
print(value)
end)
event.Event:Fire("hello")