A small multiplayer hangout game written in typed Luau on Roblox: you're a rat, there are four floating islands, and most of the activities need a friend.
Ratas is a four-zone social game I built to try out a clean, service-based Luau architecture on Roblox. The server is a set of small single-purpose services behind one boot script, the client is a set of independent controllers, and everything crossing the network goes through a named set of remotes with server-side validation. Character poses are procedural (no animation assets), and the world itself is generated by re-runnable builder modules instead of being hand-placed.
- Four zones, 2000 studs apart: a hub village, a festival island, a pair-programming loft and a cozy burrow, each with its own client-side lighting and music.
- Double-jump pounce: jumping again in mid-air launches the rat forward with a front flip. The physics run on the owning client; the server validates a cooldown and replicates the pose.
- Procedural poses: pounce, five emotes (via an emote wheel) and four seat poses, all computed from time and applied to the R6
Motor6Ds. - Minigames: a timed parkour tower with checkpoints and a best-times board, a swim race through six ordered hoops in a terrain lagoon, a colour-sequence memory puzzle, and a vault that only opens with two players on its plates.
- Pair programming: two players at a desk each get half of a bug-hunt puzzle (one sees the code, the other sees the candidate fixes) and must agree on the same answer. Roles swap each round.
- Currency and cosmetics: cheese is earned from every activity and spent on fur colours and hats at the salon.
- Persistence: per-player profile in a DataStore, with a session-only fallback when DataStores aren't available.
- Touch support: custom jump and emote buttons for phones.
Luau (--!strict in every script) on Roblox. Tooling: Rojo 7.7, luau-lsp, selene, StyLua, managed with Rokit.
ReplicatedStorage/Shared/ modules used by both server and client
Remotes.luau get-or-create RemoteEvents/RemoteFunctions by name
ClientBus.luau client-only BindableEvents between local scripts
PoseEngine.luau procedural pose definitions + Motor6D blending
RatConfig.luau, ZoneConfig.luau, CodePuzzles.luau, Theme.luau
ServerScriptService/ Init.server.luau + one ModuleScript per system
StarterPlayerScripts/ client controllers (movement, poses, ambience)
UI/ HUD, emote wheel, salon, code-lab panel, touch controls
ServerStorage/_Build/ edit-time world builders (not game logic)
default.project.json Rojo project mapping these folders into the DataModel
File suffixes decide the script class: .server.luau is a Script, .local.luau is a LocalScript, plain .luau is a ModuleScript.
Key design points:
- Boot order.
Init.server.luaurequires each service by name and calls itsstart()in dependency order (saves → currency → characters → zones → minigames). Every require andstart()is pcall-wrapped, so one broken service can't stop the others. - Validated remotes. Remotes are created in one place (
Remotes.event/func). Every server handler checks argument types, resolves ids against config, checks ownership, and charges throughCheeseService.spend. Only the owning client's own physics (pounce impulse, trampolines) is client-authoritative. - Procedural poses. Each pose is a pure function of
(alpha, elapsed)that returns per-joint offsets on the R6Motor6Ds, layered on top of the default animations. A pose replicates as two attributes (PoseName,PoseStart), and every client replays it locally. - Tag-driven behaviour. Portals, spinners, movers, bouncers and pose seats are plain parts with CollectionService tags and attributes. Bindings also listen for late arrivals, since streaming is enabled.
- Saving. Profiles are reconciled against defaults on load, autosaved every 60 s, and saved on leave and
BindToClose. Without DataStore access (e.g. in Studio) the game falls back to in-memory profiles. - Generated world. The islands are built by re-runnable builder modules in
ServerStorage/_Buildthat share a kit of parametric props, and each builder replaces its own subtree.
Tools are pinned in rokit.toml:
rokit installluau-lsp needs the Roblox type definitions next to the project (they're git-ignored):
curl -L -o globalTypes.d.luau https://raw.githubusercontent.com/JohnnyMorganz/luau-lsp/main/scripts/globalTypes.d.luauFormat, lint and type-check:
stylua --check .
selene .
rojo sourcemap default.project.json -o sourcemap.json
luau-lsp analyze --platform=roblox --sourcemap=sourcemap.json \
--definitions=@roblox=globalTypes.d.luau \
ReplicatedStorage ServerScriptService ServerStorage StarterPlayerScriptsThere are two ways to get the scripts into a place:
- Rojo:
rojo serveand connect with the Rojo Studio plugin, orrojo build -o ratas.rbxlfor a place file. The project only maps the script folders, so the built place contains code but no world geometry. - Studio script sync: Studio's built-in script sync can point at this folder directly (top-level folders mirror services, and it uses the same
.local.luaunaming). Edits on disk show up in Studio without running anything.
The world geometry is saved in the place, not the repo. To regenerate it, run the builders in ServerStorage/_Build (World, RatRig, Hats, then each zone) from the Studio command bar in edit mode.

