Skip to main content
Signals are the primary way for scripts to talk to each other. When one entity needs to notify another — a pressure plate that opens a door, a trigger block that wakes up a sleeping enemy — you emit a signal by name, and every entity whose OnSignal hook matches that name can respond. Signals can carry any Lua value as a payload, so you can pass numbers, strings, tables, or even nothing at all.

Receiving a Signal: The OnSignal Hook

To make an entity respond to a signal, define OnSignal in its script. The game calls this function whenever a signal is delivered to that entity.

The Signal Object

The signal parameter gives you everything you need to act on the incoming message: You can create a Signal object manually if you need full control over filtering:

Emitting Signals: The Signals Namespace

The Signals namespace provides several functions that let you target signals precisely — from a broadcast to every entity in the level down to a single named entity.

Signals.emit(signal)

Emits a pre-built Signal object, respecting whatever filters are set on it.
Use the table shorthand when you want a quick one-liner:

Signals.emitToAll(signalId [, data])

Broadcasts a signal to every entity in the level.

Signals.emitTo(signalId, target [, data])

Sends a signal to one specific entity.

Signals.emitToTag(signalId, tag [, data])

Sends a signal to all entities that share a given tag.

Signals.emitToType(signalId, type [, data])

Sends a signal to all entities of a specific EntityType.

Signals.emitToTypeAndTag(signalId, type, tag [, data])

Sends a signal to all entities that match both a type and a tag — the most precise broadcast filter.

Signals.emitToCustom(signalId, customFilter [, data])

Sends a signal to every entity for which customFilter returns true. The filter receives the entity and the signal as arguments.

Signal Data

The data field accepts any Lua value — a plain boolean, a number, a string, or a full table with nested fields.
On the receiving side, read it back from signal.data:
If you emit a signal without a data argument, signal.data will be nil on the receiving end. Always guard with a nil check if the field is optional.

Full Example: Pressure Plate and Gate

The following two scripts work together. A Side script acts as a pressure plate: when the ball rolls on, it emits a signal. A Block script on a gate block listens for that signal and toggles itself.
Use tag-based emission (Signals.emitToTag) when you want to control multiple entities at once without keeping references to each one individually.