Skip to content
Gang Fights

Scripting SDK · Luau

Build your own game modes.

Gang Fights servers run resources written in Luau (opens in a new tab) — Lua with optional types. From a dice-roll command to a full roleplay city: if it happens on a server, you can script it.

Status: early alpha. The scripting API only grows within a major version, so the resources you write today keep working. Custom models, textures and sounds are coming next.

Resources

A resource is a folder inside the server's recursos/ folder: a resource.toml manifest plus its scripts. Server scripts run on the server; client scripts are sent to every player and run on their PC. Every game mode that ships with the server is just a resource — copy one, rename it and change whatever you like.

folder layout
recursos/
  hello/
    resource.toml
    server/main.luau
    client/hud.luau        -- optional: runs on each player's PC
resource.toml
name = "hello"
version = "1.0.0"
description = "Says hello"
author = "You"
server_scripts = ["server/main.luau"]
client_scripts = []   # sent to each player and run on their PC
dependencies = []     # resources that must be running first
gamemode = false      # true: this resource runs the rounds
autostart = true

Your first resource

Greet players when they join and add a /dice command. Start the server and the resource runs; after editing, type restart hello in the server console and it reloads on the spot.

hello/server/main.luau
on("playerJoin", function(player: number)
  players.message(player, "Hello, " .. (players.name(player) or "?") .. "!")
end)

registerCommand("dice", function(player: number)
  chat.broadcast((players.name(player) or "?") .. " rolls " .. math.random(1, 6))
end)
server console
> resources            # list what's running
> restart hello        # reload after editing — no server restart
> players
> say Round starts in 1 minute
> ban 7 60 spamming    # by player number, for 60 minutes

What the API covers

The server API is organised in small, focused libraries. Players are identified by a number — the one everybody sees next to their nickname in the player list.

  • Events

    Joins, leaves, hits, knockouts, items, rounds, graffiti, menu picks — plus your own events between resources.

  • Chat & commands

    Colored chat, /commands with arguments, suggestions and per-player messages.

  • Timers

    setTimeout, setInterval and clearTimer for anything that runs later or repeats.

  • Players

    Nicknames, name colors and tags, admins, kicks, timed bans and stable player ids.

  • Fighters

    Health, teams, spawns, teleports, characters, freezing, invulnerability and respawns.

  • Cops

    Make any fighter a cop, cuff and uncuff, hand out keys for the cuffs.

  • Crews & orders

    Read and give the six crew orders, and work with the game's crews and their members.

  • Items

    Give, take and drop weapons and props, list what's on the floor, tune their weight.

  • NPCs

    Place characters that stand their ground, with names, icons and idle animations — shopkeepers, recruiters, quest givers.

  • Dimensions

    Run several maps at once, move fighters between them and rotate maps between matches.

  • Markers & doors

    Floating markers that show players where something happens, and control over each map's doors.

  • Objects

    Place, move and remove map objects from scripts or with the in-game editor (up to 5,000 per server).

  • Graffiti

    Create spray walls, lock them, reset them and react to every finished layer.

  • Rounds & modes

    Start, finish and stop rounds — or skip them entirely for freeroam, deathmatch and roleplay.

  • On-screen UI

    Texts, panels, bars, images, big announcements, numbered menus and text inputs.

  • Windows & clicks

    Clickable drawings, labels, item pictures and a free cursor for your own windows.

  • Blips & zones

    Icons and colored zones on every player's map.

  • Saved data

    A key-value store per resource that survives server restarts.

  • Passwords & bans

    Salted, slow password hashing for server accounts, and bans by id and IP with optional durations.

Client scripts

Client scripts are for what belongs to each player: a HUD, menus, key bindings, local chat commands, the camera and sounds. Each resource runs in its own sandbox on the player's PC.

They can read the fight but never change it — that would let each PC see something different and make cheating trivial. To change something, a client script asks the server, and the server decides.

player-hud/client/hud.luau
-- client/hud.luau
setInterval(function()
  local me = fighters.get(localPlayer.fighter() or -1)
  if me then
    ui.text("hp", "Health " .. math.floor(me.health), { position = "bottom-right" })
  end
end, 200)

on("keyDown", function(key)
  if key == "F3" then
    emitServer("askStats")   -- handled on the server with onClient("askStats", ...)
  end
end)

Sandbox & limits

  • No outside access

    Scripts can't touch files, the network or the operating system, and can't replace API functions.

  • 250 ms per run

    A script that runs too long in one go is stopped — an infinite loop can't freeze the server.

  • 64 MB per resource

    Each resource gets its own memory budget.

  • Errors stay contained

    Errors go to the server log with the resource name; the resource keeps running.

Editor support: the SDK ships type definitions for the server and client APIs. Add them to luau-lsp (opens in a new tab) (for example through a Luau extension for VS Code) for autocompletion and type checking.

Templates included

Every server comes with these resources. Nothing in them is special to the game — your own resources can do the same and more.

welcome
Greets players and counts their visits with saved data.
basic-commands
/players and a periodic tip in the chat.
player-hud
Client scripts: a HUD, F2 to hide it, F3 to ask the server for your stats.
scoreboard
A knockout table, the round in big letters and a /stats menu.
fight-basics
Announces knockouts and round winners, plus /heal and /where.
deathmatch
A game mode without rounds: respawns, a kill feed, first to 10 wins.
roleplay
Accounts, characters, saved positions, a hospital and a subway between neighborhoods.
roleplay-chat
Local chat, /me, /do, /shout, /ooc and friends.
mapvote
A vote for the next map at the end of each match.
mapping
Map objects and the in-game placement editor.
admin
Admin tools such as free-flying around the map.

Running a server

Host from the game's menu for quick sessions, or build a dedicated server package with CreateServer.bat in your game folder. It asks for the target system (Windows or Linux) and the maps, and creates a folder with the server program, its data, your resources, a servidor.cfg and the SDK docs.

  • Linux: Ubuntu 24.04+ or Debian 12+, 64-bit, with the ALSA and udev libraries installed.
  • Ports: UDP 27015 for the game and UDP 27016 for the server search (or the port you configure and the next one).
  • Updates: the server tells you on startup when a new version is out. Update the game, rebuild the package and replace the program and data — your config and resources stay.
  • Private data: the package's data/ folder is built from your own copy of the original game. Never share it publicly.

More on hosting

Full reference

The complete API reference — every function, event and option — ships with every server package in sdk/README.md, together with the editor type definitions in sdk/types/. It always matches the version you're running.