FiveM scripting basics: resources, fxmanifest, events and the AI skill

375 installs on skills.sh

Updated

Don’t want to manage skills yourself? Get the full app.

A FiveM resource is a folder with an fxmanifest.lua plus client, server and shared scripts that talk through events. This guide explains that structure, the mistakes that stop resources from starting and the AI skill that avoids them.

FiveM scripting starts with resources: folders that contain an fxmanifest.lua and the client, server and shared scripts that make up one feature. Every framework, job script and UI on a server is a resource, so the basics apply to anyone who writes for FiveM. This page covers what the FiveM basics skill for FiveAI documents, the mistakes that stop resources from starting, and how to install the skill in your AI assistant.

What the FiveM basics skill gives you

The skill is a SKILL.md file with one rule file per topic:

  • structure: how to organize a resource, client and server separation, logical grouping and naming.
  • fxmanifest: the manifest keys that matter: fx_version, game, client_scripts, server_scripts, shared_scripts, files and dependencies.
  • client-server: what runs where, shared code and the communication patterns between the two sides.
  • events: RegisterNetEvent, TriggerServerEvent, TriggerClientEvent, naming conventions and security.
  • exports: how to define an export and call it from another resource.
  • debugging: the server console versus the client F8 console, and when to ask for F8 logs when the server shows nothing.
  • optimization: locals, loop timing, caching PlayerPedId(), vector distance, state bags and folder structure.
  • reference-links: the official docs at https://docs.fivem.net/docs/ and the natives reference at https://docs.fivem.net/natives/.

Use it whenever you create or edit a resource, no matter which framework runs on top.

Common mistakes with FiveM resources

  • Missing or wrong fx_version or game in fxmanifest.lua. Symptom: the resource fails to start and the server console prints a manifest error. Fix: declare fx_version 'cerulean' and game 'gta5' at the top of the manifest, then list your scripts.
  • Server logic in a client file. Symptom: a database call or a server-only native runs on the client, throws, or exposes data to every player. Fix: keep anything that touches the database, money or permissions in server_scripts, and send results to the client through events.
  • RegisterNetEvent without a handler, or handler names that do not match the trigger. Symptom: the event fires and nothing happens, with no error in either console. Fix: register the event and add the handler with the same string, and use a resource prefix such as myresource:server:doThing so names never collide.
  • Wrong ensure order in server.cfg. Symptom: a resource starts before the framework or library it needs, so its exports are nil at load time. Fix: add dependency 'ox_lib' (or dependencies { ... }) in fxmanifest.lua and ensure the dependency earlier in server.cfg.
  • Heavy while true do Wait(0) end loops and globals everywhere. Symptom: high resource time in resmon and name collisions between scripts. Fix: use a longer Wait when nothing is nearby, cache PlayerPedId() outside the loop, compare distances with vector math, and declare variables with local.

Why AI assistants get FiveM wrong

A generic assistant does not know which side of the network a native belongs to, so it calls client natives on the server, invents exports that a resource never had, and writes manifests from memory with an outdated fx_version or a missing game line. It also reaches for the oldest event syntax in its training data and rarely adds a resource prefix to event names.

The skill gives it a short reference for each of those areas: the manifest keys, the client and server split, the event functions and their naming and security rules, the export pattern, and the optimization guidance. It also tells the assistant to check the natives reference at docs.fivem.net instead of guessing a native's signature, and to ask for F8 logs when a client-side bug leaves the server console clean. That is what turns a plausible script into one that starts and runs.

Install the FiveM basics skill in 30 seconds

  1. Click "Download SKILL.md" at the top of this page.
  2. Unzip it into your AI tool's skills or rules folder. The install section below shows the exact path for Claude Code, Cursor and VS Code.
  3. Ask the assistant for something concrete, such as a resource with a server event and a client command, and check that the manifest has fx_version and game and that the event names match on both sides.

How to install this skill

Download the zip, unzip it, and place the folder where your tool loads skills or rules. The exact path depends on the tool:

Claude Code

Unzip into .claude/skills/fivem-basics/ inside the project (the folder must contain SKILL.md). For every project, use ~/.claude/skills/fivem-basics/ instead.

Claude Code skills docs

Cursor

Cursor loads project rules from .cursor/rules/. Add a rule file there that points to the unzipped skill, or paste the contents of SKILL.md and the rule files into a rule. The format is .mdc with frontmatter and changes between versions, so check the docs for your version.

Cursor rules docs

VS Code / Copilot

Copilot reads instruction files from .github/instructions/*.instructions.md. Copy SKILL.md there with an applyTo glob for your Lua files, and keep the rule files next to it.

VS Code custom instructions docs

The SKILL.md file

This is the file your AI assistant reads. It links to the rule files bundled in the download.

Skill contents (includes SKILL.md and any other files)

FiveM basics

Best practices for FiveM — resources, manifest, client/server, events. Use this skill whenever you are dealing with FiveM code to obtain domain-specific knowledge.

When to use

How to use

Read individual rule files for detailed explanations and examples:

  • rules/structure.md — Resource structure and organization: scope, client/server separation, logical grouping, naming conventions.
  • rules/fxmanifest.md — Resource manifest (fxmanifest.lua): fx_version, game, client_scripts, server_script, files, dependencies.
  • rules/client-server.md — Client vs server scripts, shared code, communication patterns.
  • rules/events.md — Events in Lua: RegisterNetEvent, TriggerServerEvent, TriggerClientEvent, naming conventions, security.
  • rules/exports.md — Defining and consuming exports between resources.
  • rules/debugging.md — Server vs client (F8) logs; when to ask the user for F8 logs if there's no server-side error.
  • rules/optimization.md — Lua/FiveM optimization: locals, loops, natives (PlayerPedId, vector distance), state bags, security, readability, folder structure.
  • rules/reference-links.md — Official docs and natives reference.

Frequently asked questions

Should I write FiveM resources in Lua or JavaScript?
Both are supported by the FiveM runtime. Lua is the most common choice and is what ESX, QBCore and most released scripts use, so Lua gives you more examples and easier integration. JavaScript works well if your team already lives in Node.
Where do I find the list of FiveM natives?
The official reference is https://docs.fivem.net/natives/. It lists every native with its parameters, return values and the side (client or server) where it runs. General docs live at https://docs.fivem.net/docs/.
Can I use this skill with ChatGPT?
Yes. SKILL.md is plain markdown. Paste it into a custom instruction or attach it to a ChatGPT project. Claude Code, Cursor and VS Code load it from their skills or rules folder.

Longer reads from the FiveAI blog on the same topic.

More skills