shared
RegisterNetEvent
FiveM shared native documentation with a Lua example.
Summary
Registers an event that can be triggered across the network (client↔server). Required for any event triggered by TriggerServerEvent or TriggerClientEvent.
Returns
void
Parameters
eventNamestringThe network event name to register.handlerfunctionOptional. The handler function (modern syntax registers it inline).Example
-- Modern syntax (handler inline)
RegisterNetEvent('myscript:doThing', function(arg)
-- runs when the event is triggered over the network
end)
-- source is available in server-side net events
RegisterNetEvent('myscript:serverThing', function(data)
local src = source
end)Common pitfalls
- A plain AddEventHandler won't receive networked events — you must RegisterNetEvent for cross-network events.
- On the server, always validate the caller and data — networked events are a common exploit surface.
Related natives
Related guides
FiveM scripts done right
Optimized, dual-framework scripts for QBCore and ESX from Viper Development — escrow protected, delivered instantly to your Cfx portal.
Browse Scripts →