Signal¶
Type
Signal runs functions when a service or object event fires, such as Chat.MessageSent, Input.Pressed, or tween.Finished. For entity and component lifecycle signals, use entity:On(Component.<Name>.<Signal>, fn) or Component.<Name>.Added:Connect(fn).
Connect¶
Connect runs a function every time the signal emits, until it is disconnected or its owner ends, and returns a Connection with Connected and Disconnect. Each call runs on its own thread, so it may call task.wait, and an error in one function does not stop the others.
Example
Once¶
Once runs a function the next time the signal emits, then disconnects it, and returns a Connection.
Example
Wait¶
Wait pauses the script until the signal next emits, then returns true followed by the emitted values. Pass seconds to stop waiting after that many seconds. Wait returns false when the time runs out or the signal's owner ends, and Wait(0) returns false at once. It cannot pause Update or another callback that must return at once; call it from the top of the script or from task.spawn.