Start developing for FiveM
How to start writing FiveM scripts: choosing Lua, JavaScript or C#, setting up VS Code with Lua language server and FiveM natives, git, a dev server and a learning plan.
Esta documentación está en inglés por ahora.
Writing FiveM scripts is one of the most rewarding ways to learn programming: you change a line, type ensure, and see the result in a game world a second later. This section takes you from zero to publishing your own resource.
How FiveM code works, in one minute
- Your code lives in resources: folders with an
fxmanifest.luaand some scripts. - Client scripts run on every player’s PC, inside their game. They draw things, read keys, spawn local effects, and call game natives.
- Server scripts run once, in FXServer. They own the truth: money, inventories, database, permissions.
- The two sides talk with events. The client can never be trusted, so the server checks everything.
- A web page (NUI) can be your UI, written in HTML, CSS and JavaScript (or React, Vue, Svelte…).
That’s the whole model. Every page in this section expands one piece.
Pick a language
FiveM runs three scripting runtimes, and a resource can mix them.
| Language | Runtime | Pros | Cons |
|---|---|---|---|
| Lua 5.4 (CfxLua) | Built in | What 90% of resources, frameworks and tutorials use. Simple, fast to iterate. | Dynamic typing: mistakes show up at runtime. |
| JavaScript / TypeScript | V8 (client), Node.js (server, 16 by default, 22 with node_version '22') |
npm packages on the server, TypeScript types, familiar to web devs. | Fewer examples, some framework APIs are Lua first. |
| C# | Mono on Legacy (the Enhanced platform uses .NET 10) | Strong typing, big projects stay tidy, vMenu is written in C#. | Needs a build step, fewer community examples. |
Start with Lua. Frameworks (QBCore, Qbox, ESX), libraries (ox_lib) and almost every tutorial and forum answer are Lua. You can always add a React UI or a TypeScript server later.
Note
Since June 2025, all Lua scripts run on Lua 5.4 and Lua 5.3 is deprecated. You’ll still see lua54 'yes' in manifests: it’s no longer required on current artifacts but it’s harmless, and some tools and older guides still expect it.
Tools you need
1. A local dev server
Develop on your own PC, never on the live server. Set one up with txAdmin in ten minutes: Windows setup. Use the FiveM Basic Server recipe for learning, or the framework you target. Keep sv_maxclients low and consider a separate license key for it.
2. Visual Studio Code
VS Code is what most FiveM developers use. Install these extensions:
| Extension | Why |
|---|---|
| Lua by sumneko (Lua Language Server) | Autocomplete, type checking, go to definition, diagnostics. |
CfxLua IntelliSense (overextended/cfxlua-vscode) |
Sets up fivem-lls-addon: declarations for every FiveM and GTA native, plus CfxLua syntax like `backtick hashes` and compound operators. |
| GitLens or the built in Git panel | See what changed, when, and why. |
| ESLint / Prettier | If you write JavaScript or NUI. |
With the native declarations installed, typing GetEntityCoo completes to GetEntityCoords(entity, alive) with parameter hints. That alone saves hours of alt tabbing to the docs. The ox libraries also ship Lua type definitions (ox_types).
3. Git
Put every resource (or your whole server folder) in git from day one. It’s your undo button, your backup, and how you work with other developers. Keep secrets out of it: see Security basics.
4. The docs, bookmarked
- Scripting manual and scripting reference on docs.fivem.net.
- Natives reference: every function the game gives you.
- Resource manifest reference.
- For UI and game data lookups, fivemad has references for controls, blips and markers, models and hashes, props, particles, sounds and the map with coordinates.
A learning plan
Work through these in order. Each page ends with something that runs.
- Your first resource: folder, manifest, a
/hellocommand, restarting, reading the F8 console. - Client, server and events: the two sides and how they talk safely.
- Natives: finding and using game functions, hashes, common natives.
- Threads and performance: loops,
Wait, resmon and the profiler. - State bags and OneSync: syncing data, entity ownership, routing buckets.
- NUI basics: HTML UIs, messages, callbacks, focus.
- Exports and dependencies: reusing code between resources, working with frameworks and libraries.
- Debugging: reading errors, print debugging, dev tools, common bugs.
- Streaming custom assets: cars, clothes, maps, props and sounds.
- Publishing a resource: versioning, README, license, the forum, Tebex and escrow.
If you prefer video, the Lua scripting course in the video archive follows a similar path.
Habits that make you better fast
- Read other people’s code. Open ox_lib, a Qbox resource or vMenu’s source on GitHub and see how they solve things.
- Keep the F8 console open while testing. Errors tell you the file and line.
- Small steps. Change one thing,
ensure, test. Don’t write 300 lines and then start the server. - Server decides, client displays. If you remember one rule, remember that one.
- Don’t copy paste from leaked scripts. Bad habits, license trouble, and sometimes backdoors.
- Ask good questions on the forum: what you tried, the exact error, the code (formatted), what you expected.
