116 online 3 members  + Join RP Base  +
×

Guide for creators  ·  8 min read  ·  updated Nov 12, 2026

Write your first FiveM script in Lua

Short answer

Make a folder with an fxmanifest.lua and a client.lua, register a command with RegisterCommand, start it with ensure and use restart yourscript after each change. Server code goes in server.lua and talks to the client through events.

A small working FiveM resource from scratch: the manifest, a client command, a server event and how to test changes without restarting the whole server.

The folder

hello/
  fxmanifest.lua
  client.lua
  server.lua

The manifest

fx_version 'cerulean'
game 'gta5'
lua54 'yes'

client_script 'client.lua'
server_script 'server.lua'

A client command

RegisterCommand('hello', function()
    local name = GetPlayerName(PlayerId())
    TriggerEvent('chat:addMessage', { args = { 'RP Base', 'Hi ' .. name } })
    TriggerServerEvent('hello:said')
end, false)

The server side

RegisterNetEvent('hello:said', function()
    local src = source
    print(('%s said hello'):format(GetPlayerName(src)))
end)

source is the player who sent the event. Save it in a local first: it changes after any Wait.

Run it

Put the folder in resources, add ensure hello to server.cfg and restart. After a change type restart hello in the server console, no full restart needed.

Never trust the client

Anything a client sends can be faked. If the client says it earned money, check on the server that it could have.

Next steps

Read fxmanifest.lua explained, then add a UI with NUI basics. Stuck? Paste the error in Scripts and Lua help.
Check a resource before you install it

The free backdoor scanner reads every Lua and JavaScript file and shows the lines that look like a backdoor.

Open scanner
fxmanifest.lua explainedNext guidefxmanifest.lua explainedCreators, 5 min read