Create your first script
From empty folder to an Atlas shop that sells water.
What you build
A tiny server-authoritative shop: pay cash, receive water.
1. Create the resource
Follow Creating a Resource for fxmanifest.lua + Atlas.IsReady() boot check.
2. Config
lua
-- shared/config.lua
Config = {
Price = 5,
Item = 'water',
}3. Server
lua
RegisterNetEvent('tutorial_shop:server:buy', function()
local src = source
if not Atlas.IsReady() then return end
local can = Atlas.Inventory.CanCarry(src, Config.Item, 1)
if not can or not can.ok then return end
if not Atlas.Money.Remove(src, 'cash', Config.Price) then return end
local added = Atlas.Inventory.Add(src, Config.Item, 1)
if not added.ok then
Atlas.Money.Add(src, 'cash', Config.Price)
end
end)4. Client
lua
RegisterCommand('buywater', function()
TriggerServerEvent('tutorial_shop:server:buy')
end, false)5. Test
- Ensure the resource after
atlas_inventory - Give yourself cash (admin / bank)
- Run
/buywater - Confirm item + cash change
You just wrote an Atlas script the production way.
Atlas