AstScriptSignal
Registers event handlers or waits for an event.
Behavior
AstScriptSignal represents an API event. Use Connect to register a handler or
Wait to yield until the next event. Use
BindableEvent to create a script-triggered event.
Summary
Connect(function): AstScriptConnectionRegisters a callback and returns an AstScriptConnection.
ConnectParallel(this: function): AstScriptConnectionRegisters a handler for the parallel phase and returns an AstScriptConnection.
Once(this: function): AstScriptConnectionRegisters a callback for the next event only.
Wait(…)Yields the current thread until the signal fires, then returns the signal's event arguments.
Methods
Connect
AstScriptSignal:Connect(function): AstScriptConnectionRegisters a callback and returns an AstScriptConnection. Each event invokes the callback on a separate thread. Callback errors do not disconnect the handler. Repeated calls add separate connections.
ConnectParallel
AstScriptSignal:ConnectParallel(this: function): AstScriptConnectionRegisters a handler for the parallel phase and returns an
AstScriptConnection. The calling script must belong to a parallel-enabled
ExecutionGroup. Follow each member's thread-safety metadata inside the handler;
call task.synchronize() before operations that require serial execution.
Once
AstScriptSignal:Once(this: function): AstScriptConnectionRegisters a callback for the next event only. The connection is removed before the callback runs, preventing recursive invocation of that connection.
Wait
AstScriptSignal:Wait(…)Yields the current thread until the signal fires, then returns the signal's event arguments.
Operators
__index · __type
Example
workspace.ChildAdded:Once(function(child)
print(child.Name)
end)