Custom signals
Signal objects and their connection methods.
Functions
NativeSignal:ConnectListen to a runtime-backed event, such as a WebSocket message or close event. Use it to process repeated events for as long as the owning resource is active. Keep the returned connection and disconnect it during cleanup.
NativeSignal:FireForward the supplied arguments to the underlying event.
NativeSignal:OnceListen for the next firing of a runtime-backed event, then disconnect the listener. Use it for one event, such as the first response on a connection. The handler is removed after that event, so later messages need another subscription.
NativeSignal:WaitWait for the next firing of a runtime-backed event. Use it to await one event’s arguments in the current coroutine. It observes the next event, so waiting after a one-time event has already occurred can leave the coroutine waiting indefinitely.
Signal:ConnectRegister a callback that receives the arguments supplied to this signal’s Fire method. Use it for ongoing subscriptions such as updating a preview after each settings change. Connecting registers the function; it does not immediately call it.
Signal:DestroyDestroy this custom signal and disconnect its registered listeners. Use it when the component that owns the signal is finished. Release the signal and its connections instead of keeping a discarded UI subscribed indefinitely.
Signal:DisconnectAllDisconnect every callback currently registered with this signal. Use it to reset a collection of listeners while keeping the signal itself available. Register new listeners afterward when rebuilding a UI.
Signal:FireDeliver an event to this signal’s listeners using the supplied arguments. Use it to publish a change after updating your script’s state. Supply all the values listeners need so they do not have to reach back into the producer.
Signal:OnceRegister a callback that is disconnected when it receives its first event. Use it for a one-time notification, such as the first successful import. Further events do not call that listener again.
Signal:WaitSuspend the calling coroutine until this signal fires, then receive that event’s arguments. Use it when the next step needs an event result rather than a persistent callback. Start waiting before firing the event; a previous event is not replayed.
Signal.newCreate a custom Luau signal for passing events between parts of a script. Use a custom signal to keep a producer, such as a settings editor, independent from the code that reacts to its changes. Save connections so listeners can be removed when their UI closes.
SignalConnection:DisconnectStop this connection from receiving future signal events. Use it to unsubscribe one consumer while the other listeners continue receiving events. Its Connected flag becomes false after disconnection.