Your first Reflex module
A Reflex module has two sides:
scripts/main.luaruns on the player’s client;scripts/server.luaruns in that player’s server context.
They expose different API sets and exchange Lua tables through Network.
1. Create the project
Section titled “1. Create the project”- Open the module menu and select Create.
- Name the module
HelloReflex. - Enable Is Reflex.
- Confirm creation and select this Reflex module as active.
- Start a custom game session.
The project directory should contain both entry points:
HelloReflex/├── module.json└── scripts/ ├── main.lua └── server.lua2. Add the client code
Section titled “2. Add the client code”Open scripts/main.lua:
Network:OnTableReceived(function(data) if data.kind == "server_tick" then print("Server tick: " .. tostring(data.tick)) endend)
Network:SendTable({ kind = "get_server_tick"})The client registers its response handler and then sends a request to the server side of the same module.
3. Add the server code
Section titled “3. Add the server code”Open scripts/server.lua:
Network:OnTableReceived(function(data) if data.kind == "get_server_tick" then Network:SendTable({ kind = "server_tick", tick = Time.Tick }) endend)The server checks the message type and sends its current tick back. Once both sides are loaded, the client console shows Server tick: ....
If no response appears immediately after hot reload, save main.lua once more. The client request must be sent after the server side is ready.
API contexts
Section titled “API contexts”Do not move client code into server.lua without checking the reference.
| Capability | main.lua |
server.lua |
|---|---|---|
ImGui, UI, Cameras |
✅ | ❌ |
Scheduler:OnFrame() |
✅ | ❌ |
Scheduler:OnTick() |
❌ | ✅ |
Network |
✅ | ✅ |
| Server game API methods | Limited | ✅ |
API pages mark client and server members separately.
Data supported by Network
Section titled “Data supported by Network”Strings, numbers, booleans, and nested Lua tables can be sent. Functions and API objects such as Agent or Vector3 are not serialized.
Send compound values as numbers:
Network:SendTable({ position = { x = position.x, y = position.y, z = position.z }})Server-logic rules
Section titled “Server-logic rules”- check a message-type field such as
kind; - validate the range and meaning of every client value;
- do not trust data merely because it arrived through
Network; - do not call client APIs from
server.lua; - use
Scheduler:OnTick()for repeating server work.
Continue with Network, Scheduler, and the reference pages for the game objects you need.