Skip to content

BindableEvent

An event that scripts on the same side, server or client, can fire and listen to.

  • Inherits: Instance
  • Creatable: Yes: new BindableEvent(), or Instance.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.

Inherited from Instance: name, archivable, id, className, parent, destroyed

fire(...args: unknown[]): void

Fires 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

Arguments: ...args: unknown[]

Fires with the arguments passed to fire.

Inherited from Instance: changed, childAdded, childRemoved, descendantAdded, descendantRemoving, ancestryChanged, destroying, attributeChanged

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');