Net events
Send events between the players' game and your server - and why you never trust the client.
#Client to server
A client can only call events that a resource has registered:
RegisterNetEvent('shop:buy', function(item, amount)
local player = source -- the player's id
print(GetPlayerName(player) .. ' buys ' .. amount .. 'x ' .. item)
end)RegisterServerEventis an alias forRegisterNetEvent.RegisterNetEvent('name')without a function, plusAddEventHandler('name', fn), works too.
In the client (Blueprint): Vantix Menu Subsystem → Trigger Server Event with EventName = "shop:buy" and JsonArgs = ["sword", 2] (a JSON array).
#Server to client
TriggerClientEvent('shop:bought', source, 'sword') -- one player
TriggerClientEvent('weather:set', -1, 'rain') -- all playersIn the client, bind On Server Event (EventName, JsonArgs) and parse JsonArgs.
#Messages
SendMessage(id, 'Hello!') -- one player
SendMessage(-1, 'Server restarts in 5 minutes') -- all playersThe client gets them in On Server Message. If that isn't bound, the message is shown on screen. (Internally it's the client event vantix:message.)
#Limits
- Max 60 events per second per player. The rest are dropped.
- Max 16 KB per event. Event names max 64 characters.
#Never trust the client
Anything from a client can be faked. Always check types and values, and let the server decide prices, money, positions and so on.
RegisterNetEvent('bank:withdraw', function(amount)
if type(amount) ~= 'number' or amount <= 0 or amount > 10000 then return end
-- check the balance on the server, not what the client says ...
end)A net event without checks is an open door. Validate every argument before you use it.
Last updated 2026-12-06