Skip to content

Running a server

The server is one program, server. It runs a mod, plays its matches, and sends players the mod’s files as they join. It finds the stock mod in the folder stock beside the mod’s, and says where as it starts.

Terminal window
server --mod content/mods/stock --config server.jsonc
Flag What it does
--port <n> the port players join on, 28960 by default
--mod <folder> the mod to run, the stock mod by default; also one file, <name>.server.luau
--map <name>, --gametype <name> the first match; without them, the rotation’s first
--config <file> the settings file, JSONC
--set name=value a setting, over the file’s
--lock name=value a setting no admin or mod can change
--key <file> the server’s key, server.key by default
--bots <n> bots playing on the server, as targets
--reload for mod makers: an edit of the mod takes effect at once

Open the port both ways, on UDP and TCP:

  • UDP carries the game.
  • TCP carries the files players download as they join: the mod’s maps, models, sounds and scripts.

The server list checks the UDP port from the internet before it lists the server. If players cannot reach it, the server says so as it starts.

Beside server.key the server keeps:

File What it holds
server.key the server’s key, made on its first run
bans.json the bans, so they outlast a restart
served/ the files players download, by their hash

Keep server.key secret: a copy of it can pose as your server. Move it with the server to a new machine. Players remember each server’s key. If the key changes, players who joined by name are refused until they type /forget <address>.

Each server needs a folder of its own for these files. On one machine, give each server its own --key, such as --key hill/server.key: its bans.json and served/ go beside it.

Ctrl+C, or SIGTERM, stops the server cleanly. It lets the mod finish what it is doing, such as saving players’ records, and prints what it waits for every 10 seconds. A second Ctrl+C stops it at once.

Docker kills a container 10 seconds after SIGTERM. If your mod saves to a database, give it longer with stop_grace_period.

Without --reload, the server reads the mod’s files at the start of each match. Copy a new version of the mod onto a running server, and it takes effect at the next match.