Skip to content
Atlas

Client → server flow

Wire a target / keybind into a validated server action.

Pattern

UI or ox_target on the client → TriggerServerEvent → validate → mutate → notify.

Client sketch

lua
exports.ox_target:addBoxZone({
    coords = vec3(0.0, 0.0, 72.0),
    size = vec3(1.5, 1.5, 2.0),
    options = {
        {
            name = 'atlas_tutorial_shop',
            label = 'Buy water',
            onSelect = function()
                TriggerServerEvent('tutorial_shop:server:buy')
            end,
        },
    },
})

Server sketch

Validate everything again — coords, cooldowns, price, item — even if the client already “checked”.

Done when

  • Spam-clicking cannot duplicate items
  • Failed inventory refunds money
  • No trusted client amounts