Skip to main content

Events

The Events system is the primary communication mechanism in HELIX. It enables structured data transfer between the client and server using global registration and triggering functions. Events support strings, numbers, booleans, nil, vectors, and tables as arguments.

tip

The triggering controller is passed automatically as the first parameter when a client triggers a server event -- similar to how source is passed in FiveM.


Core Functions

FunctionParametersAuthorityDescription
RegisterClientEventname: string, callback: functionClientRegisters a client-side event handler. Called when the server triggers an event targeted at this client.
RegisterServerEventname: string, callback: functionServerRegisters a server-side event handler. The triggering player controller is automatically passed as the first argument.
TriggerClientEventcontroller: PlayerController, name: string, ...args: anyServerSends an event from the server to a specific client. All extra arguments are serialized and passed to the client handler.
TriggerLocalClientEventname: string, ...args: anyClientSends an event from a client script to another client-side Lua package on the same client.
TriggerServerEventname: string, ...args: anyClientSends an event from the client to the server. The triggering controller is passed automatically as the first argument to the server handler.
TriggerLocalServerEventname: string, ...args: anyServerSends an event from a server script to another server-side Lua package, enabling cross-package communication without client involvement.
BroadcastEventname: string, ...args: anyServerSends an event from the server to all connected clients.

Examples

Registering and Triggering Events

// Events are handled via Lua or JavaScript scripting.
// See the Lua and JavaScript tabs for usage examples.

Server-Side Event Handling

// Server events are handled via Lua scripting.

Cross-Package Communication

// Cross-package events use the same Lua event system.

caution

Events send data over the network. Supported argument types include strings, numbers, booleans, nil, vectors, and tables. Function references and complex objects cannot be sent remotely.