You can build and maintain a FiveM server with an AI coding assistant today, but only if you give it the right context. Out of the box, Cursor, Claude Code and Copilot know GTA V natives from a few years ago, mix up ESX and QBCore, and guess at oxmysql syntax. The workflow below fixes that: install txAdmin with a recipe, open the server folder in your editor, load FiveM-specific skills, and prompt with real console errors and file paths instead of vague requests. The AI writes the resource, you review it against docs.fivem.net, and you test it on a local server before it touches production.
What AI can and cannot do for a FiveM server right now
Set expectations before you start, because most of the frustration people have with “AI for FiveM” comes from asking it the wrong things.
What works well:
- Writing small standalone resources (a command, a simple job, a vehicle shop menu, a Discord webhook logger) when you describe the behaviour and the framework precisely.
- Explaining a console error you paste in. “attempt to index a nil value (global ‘QBCore’)” is a solved problem for a model that knows how QBCore exports work.
- Converting between frameworks or libraries, for example moving a script from mysql-async to oxmysql, or from
qb-menutoox_libcontext menus. - Reading a resource you did not write and telling you what it does, which events it exposes, and where it is unsafe.
What does not work:
- “Build me a full roleplay server.” It will produce a folder of half-connected scripts with invented events. Servers are built resource by resource.
- Anything that depends on the current state of a paid script it has never seen. It will guess the exports and get them wrong.
- Debugging without logs. If you only say “players can’t connect”, it will list ten generic causes. Give it the txAdmin console output and it will usually point at the actual line.
Prerequisites before you open Cursor or Claude Code
You need a working server before the AI is useful. Get these ready first:
- A Cfx.re license key. Create it in the Cfx.re Portal (the old Keymaster). One key per server, tied to your account.
- FXServer artifacts. Download the latest recommended build for Windows or Linux from the Cfx.re artifacts page. Do not grab a random old build from a tutorial.
- txAdmin. It ships inside the artifacts. On Windows you run
FXServer.exe, on Linux./run.sh, and it opens the setup wizard on port 40120. - MariaDB or MySQL. MariaDB 10.6 or newer is the usual pick. Create a database and a user with a password before you run a recipe.
- A framework decision. ESX, QBCore or Qbox. If you have not decided, read our ESX vs QBCore vs Qbox comparison first. The choice changes every prompt you will write later.
- An editor with an agent. Cursor, Claude Code (terminal) or VS Code with Copilot or Cline. All of them can read a folder and edit files, which is the only thing that matters here.
Step 1: install txAdmin with a recipe
Start FXServer.exe (or ./run.sh), open http://localhost:40120, and follow the wizard. When it asks how to deploy, pick a recipe. The official ones cover ESX Legacy, QBCore and Qbox, and they download the framework, the base resources, and create server.cfg with the correct ensure order for you.
During the recipe you will be asked for the database connection. Use the user you created earlier. The recipe writes it into server.cfg as:
set mysql_connection_string "mysql://fivem:yourpassword@localhost/fivem?charset=utf8mb4"
Start the server once from txAdmin and confirm you can connect with your client before you touch any code. If it fails here, it is not an AI problem yet. Our post on txAdmin errors that stop the server from starting covers the usual suspects.
Step 2: open the server folder in your editor
Open the whole txData/<your-server>/ folder, not just one resource. The agent needs to see server.cfg, resources/, and the framework core to make sensible decisions. In Cursor that is File > Open Folder. In Claude Code you cd into the folder and run claude.
Two small things save a lot of time later:
- Add a
.cursorignoreor.claudeignore-style exclusion forcache/andresources/[cfx-default]/if your tool supports it. Those directories are huge and useless for the model. - Keep
server.cfgreadable. If a recipe left 200 lines of comments, the model will still read them all on every prompt.
Step 3: install the FiveAI skills
A skill is a folder with a SKILL.md file plus reference files that the agent loads when the topic comes up. It is the difference between the model guessing what lib.callback.await returns and actually knowing.
For a fresh server install these four:
- fivem-basics: resource structure,
fxmanifest.lua, client versus server scripts, events, natives. - oxlib: callbacks, context menus, input dialogs, zones, notifications.
- oxmysql:
MySQL.query.await,MySQL.insert, prepared statements, transactions. - Your framework: esx-framework or qbcore-framework.
Download each one from its page (a zip with SKILL.md and the reference files) and put it where your tool looks for skills:
- Claude Code:
.claude/skills/<skill-name>/inside the server folder. - Cursor:
.cursor/rules/(renameSKILL.mdto<skill-name>.mdcor reference it from a rule file). - VS Code with Copilot:
.github/instructions/or reference the file fromcopilot-instructions.md.
The exact folder differs per tool and changes between versions, so check the install notes on the skills page. Once loaded, ask the agent “which FiveM skills do you have available?” to confirm it sees them.
Step 4: prompt patterns that produce working code
Vague prompts produce vague scripts. These patterns work in practice:
Paste the error, then ask.
Here is the console output when I start the server:
[ script:qb-garages ] SCRIPT ERROR: @qb-garages/server/main.lua:42: attempt to index a nil value (field 'Functions'). Explain the cause and give me the fix in that file.
Describe a standalone resource with explicit constraints.
Write a standalone resource called
fa_repairkitfor QBCore using ox_lib and oxmysql. Usable itemrepairkitthat repairs the nearest owned vehicle over 10 seconds with alib.progressBar. Validate on the server that the player actually has the item before removing it. Includefxmanifest.lua,client.lua,server.luaand the SQL for the item if needed.
Ask for a review before you ask for a feature.
Read
resources/[custom]/my_shopand list every server event that trusts client data without checking it.
Force the framework.
This server runs ESX Legacy 1.10 with ox_inventory. Do not use
esx_addoninventoryorxPlayer.addInventoryItem; use ox_inventory exports.
Notice that every one of these names the framework, the library and a file path. That is what the model is missing when it produces broken code, and it is exactly what a skill supplies by default.
Step 5: review what the AI wrote
Never ensure an AI-written resource without reading it. A five-minute checklist:
- Natives. Open docs.fivem.net/natives and search each native you do not recognize. If it is not there, it does not exist. Models invent names like
GetVehicleOwnerthat sound right and are not real. - Exports. For every
exports['some_resource']:Something()check the real resource exposes it. Grep the resource forexports(orexports.to be sure. - Client versus server. Database calls, money changes and item grants belong on the server. If you see
MySQLinclient.lua, stop. fxmanifest.lua. Confirmfx_version 'cerulean',game 'gta5',lua54 'yes'if the code uses Lua 5.4 features, and thatshared_script '@ox_lib/init.lua'is present when ox_lib is used.- Event validation. Every
RegisterNetEventhandler on the server should validatesourceand the arguments. See our post on why ChatGPT writes broken FiveM scripts for the patterns.
Step 6: a local testing loop
Keep production and development separate, even if “production” is a server with 8 friends on it.
- Run a second txAdmin profile on your PC with the same recipe and a copy of the database (
mysqldumpthe live one, import locally). - Add the new resource to
server.cfgwithensure fa_repairkit, start the server, and watch the txAdmin live console for the resource name. - Test as a player. If something fails, copy the exact console line back into the editor and ask for the fix.
- Once it works, commit the resource to git. A
resources/[custom]folder in a repo is the cheapest insurance you will ever buy. - Deploy to the live server with
refreshandensure fa_repairkitfrom the txAdmin console, or restart at a quiet hour.
Run through this loop and you will notice the AI gets better at the second and third iterations, because it now has the actual error strings from your setup in context.
Where the FiveAI app fits
The workflow above works with any editor, but it has one weak point: the assistant only sees files. It does not see the txAdmin console, the database or what the server is doing while it runs. So you become the copy-paste bridge between the logs and the chat.
FiveAI removes that step. It runs on the same machine as your server, connects to txAdmin and your database, and reads the logs itself. When you say “the garage script broke after the last restart”, it checks the console, finds the failing resource, reads the file and proposes the fix, using the same skills described above. If you would rather not manage editors and skill folders, that is the easier path.
Frequently asked questions
Can AI build a complete FiveM server on its own?
No. It can install nothing, and it cannot make design decisions about your economy or jobs. What it can do is write and fix individual resources quickly once txAdmin, the database and a framework are in place. Treat it as a fast junior developer that needs precise instructions and review.
Which is better for FiveM, Cursor or Claude Code?
Both read your server folder and edit files, and both load skills. Cursor is friendlier if you want a visual editor and inline diffs. Claude Code lives in the terminal and is comfortable running commands and reading many files at once. Pick whichever you already use; the skills work in both.
Do I need to know Lua to use AI for FiveM?
Not to get started, but you need enough to review what it writes. Learn to read an fxmanifest.lua, tell a client script from a server script, and recognize a database call. Our lua-basics skill and the fivem-basics skill cover exactly that ground, and the AI can explain any line you paste back to it.
Related FiveM skills
Add these skills to Cursor, VS Code or Claude Code so the AI knows the real APIs mentioned in this post.