Data type
RBXScriptSignal
An object that runs connected functions upon a specific occurrence.
About RBXScriptSignal
The RBXScriptSignal data type, more commonly known as an Event,
provides a way for user-defined functions, called listeners, to call when
something happens in the game. When an event happens, the
RBXScriptSignal fires and calls any listeners that are connected to
it. An RBXScriptSignal may also pass arguments to each listener to
provide extra information about the event.
Methods 4
Connect
(func: function) → RBXScriptConnectionConnects the given function to the event and returns anRBXScriptConnectionthat represents it.Establishes a function to be called when the event fires. Returns an
RBXScriptConnectionobject associated with the connection.ConnectParallel
(func: function) → RBXScriptConnectionConnects the given function to the event and returns anRBXScriptConnectionthat represents it.Establishes a function to be called when the event fires. Returns an
RBXScriptConnectionobject associated with the connection. When the event fires, the signal callback is executed in a desynchronized state. UsingConnectParallelis similar to, but more efficient than, usingConnectfollowed by a call totask.desynchronizein the signal handler.Note: Scripts that connect in parallel must be rooted under an Actor.
Once
(func: function) → RBXScriptConnectionConnects the given function to the event (for a single invocation) and returns anRBXScriptConnectionthat represents it.Establishes a function to be called when the event fires. Returns an
RBXScriptConnectionobject associated with the connection. The behavior ofOnceis similar toConnect. However, instead of allowing multiple events to be received by the specified function, only the first event will be delivered. UsingOncealso ensures that the connection to the function will be automatically disconnected prior the function being called.Wait
() → VariantYields the current thread until the signal fires and returns the arguments provided by the signal.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.