Ansekai DocsAnsekai docs
All pages
Connections and security
Examples

Server code

Luau on the server

Plugins, loops and rooms are written in Luau, the typed Lua of Roblox. The code runs in a sandbox on the server: it reaches the data of its own game and nothing else, no files, no network, no other game.

What the code has

NameWhat it is
ansekai.dataPlayer Data of any player of the game
ansekai.realtimeThe Realtime Database
ansekai.storageFiles of the game
ansekai.cacheThe Cache
ansekai.roomsOpens rooms and sends players to them
ansekai.physics, ansekai.physics2dPhysics worlds
ansekai.log(...)A line in the logs of the panel
ansekai.fail(code)Stops the run and undoes its writes, the client gets the code as an error

Plugins, loops and rooms can also be drawn as nodes with Kumi, which writes this Luau for you.

The standard libraries of Luau are there too: string, table, math, os.time, bit32, utf8 and coroutine. The editor of the panel completes every name and shows what it does.

One run is one transaction

Every write of a run of a plugin, or of a step of a loop or a room, goes to the database together. When the code crashes or calls ansekai.fail, none of them stays and listening clients hear nothing.

Luau
ansekai.rpc("trade", function(ctx, params)
  ansekai.data.increment(ctx.player, "gold", -params.price)
  ansekai.data.increment(params.seller, "gold", params.price)

  if (ansekai.data.get(ctx.player, "gold") or 0) < 0 then
    ansekai.fail("not_enough_gold") -- Both writes are undone
  end
end)

A room that runs on another server than its game is the one exception: each data call commits on its own there. See Rooms.

Failing on purpose

ansekai.fail("code") is an answer, not a bug. The code is small letters, digits and _, 64 characters at most. The SDK throws it as an AnsekaiError with that code.

TypeScript
try {
  await ansekai.plugins.call("buy", { item: "sword" });
} catch (error) {
  if (error.code === "not_enough_gold") showShop();
}

Limits

Plugin runStep of a loop or a room
Memory8 MB16 MB, it stays between steps
Code time100 msHalf the time between two ticks, 50 ms at most
Whole run with waits5 s1 s
Data calls10050

A run over a limit ends with an error in the logs, its writes are undone. A loop or a room that fails five times in a row stops.

Logs

ansekai.log and every error show on the page of the plugin, the loop or the room. Logs are a help, not data: they are kept for a while and lines that come too fast are dropped.

Updated November 21, 2026

Luau on the server · Ansekai Docs