BindableEvent
An event that scripts on the same side, server or client, can fire and listen to.
- Inherits: Instance
- Creatable: Yes:
new BindableEvent(), orInstance.new('BindableEvent', parent). - Replication: Replicated: clients get a copy, and changes the server makes reach them.
Use a BindableEvent to let scripts talk without the network: for example a round script telling a scoring script that the round is over. Firing it on the server reaches server scripts only; firing it in a LocalScript reaches that device’s LocalScripts only.
Properties
Section titled “Properties”Inherited from Instance: name, archivable, id, className, parent, destroyed
Methods
Section titled “Methods”fire(...args: unknown[]): voidFires event with these arguments. Handlers run right away, before fire returns, and get the
arguments as they are (not copies).
Inherited from Instance: getPropertyChangedSignal, setAttribute, getAttribute, getAttributes, getAttributeChangedSignal, getChildren, getDescendants, findFirstChild, findFirstChildOfClass, findFirstChildWhichIsA, findFirstAncestor, findFirstAncestorWhichIsA, waitForChild, isA, isDescendantOf, isAncestorOf, getFullName, clearAllChildren, destroy, clone, toString
Events
Section titled “Events”Arguments: ...args: unknown[]
Fires with the arguments passed to fire.
Inherited from Instance: changed, childAdded, childRemoved, descendantAdded, descendantRemoving, ancestryChanged, destroying, attributeChanged
Examples
Section titled “Examples”Announce the end of a round
Section titled “Announce the end of a round”import { BindableEvent, ServerStorage, print } from '@rally/sdk';
const roundOver = new BindableEvent();roundOver.name = 'RoundOver';roundOver.parent = ServerStorage;
roundOver.event.connect((winner) => print(winner, 'won the round'));roundOver.fire('Ann');