Skip to content
Atlas

Docs

Scripting Basics

How to write Atlas Lua — server truth, client request.

Mental model

  1. Client asks.
  2. Server validates.
  3. Server mutates money / items / jobs / spawn.
  4. Client receives the result and plays FX / UI.

Never trust the client for amounts, item names, or privileged coords.

Import

lua
shared_script '@atlas_core/imports.lua'

Atlas is available on both sides. Money, inventory, jobs, and permissions that mutate state are server-only.

Wait for ready

lua
if not Atlas.IsReady() then
    return
end

Or poll once at boot in a thread (see Creating a Resource).

Read player / character

lua
-- server
local player = Atlas.Players.Get(source)
local character = Atlas.Characters.Get(source)

if not character then
    return
end

Returned tables are snapshots — safe to read, not live references to internal state.

Permissions

lua
if not Atlas.Permissions.Has(source, 'atlas.admin.health') then
    return
end

Wire ACE in permissions.cfg. Prefer least privilege.