X
X
X
X
All systems operational · 200 Tbps+ DDoS protection active
Sign Up Sign In 08505574494

How to Add Scripts to a FiveM Server: Step-by-Step Guide

HomepageArticlesFiveM ServerHow to Add Scripts to a FiveM Serve...
How to Add Scripts to a FiveM Server: ESX and QBCore Guide

Adding a script to FiveM is not just dropping a folder onto the server and restarting. Scripts run as resources in FiveM, and for a resource to work it must sit in the right folder, carry a valid fxmanifest.lua, have its dependencies loaded before it, and — where required — have its database tables imported. If any one of those four is missing, the script either silently does nothing or floods your console with errors. This guide walks through installing scripts on ESX and QBCore from scratch, debugging included.

What a "Script" Actually Is in FiveM

In FiveM everything is a resource: your framework, maps, vehicle models, the inventory system and that job script you just downloaded. A resource is simply a folder containing at least an fxmanifest.lua file.

That file tells the server which game it targets, which files run on the client, which run on the server, and which resources it depends on. A typical manifest declares:

  • fx_version 'cerulean' — the API version
  • game 'gta5' — the target game
  • client_scripts { 'client/*.lua' } — files that run client-side
  • server_scripts { '@oxmysql/lib/MySQL.lua', 'server/*.lua' } — files that run server-side
  • shared_scripts { 'config.lua' } — files loaded on both sides
  • dependencies { 'es_extended', 'ox_lib' } — dependencies

If a folder has no fxmanifest.lua, the server does not treat it as a resource — it prints a warning and moves on. That accounts for a good share of "I uploaded the script and nothing happened" reports.

Before You Start: Check You Downloaded the Right Build

The first thing to verify is which framework the script was written for. An inventory script built for ESX will not work on a QBCore server — and even if it loads, it cannot read player data. Script pages normally carry one of these labels: ESX, QBCore, Qbox or Standalone. Standalone scripts are framework-independent and run anywhere.

Second check: the README.md inside the archive. Dependencies are listed there, and skipping it is how people lose an afternoon.

Step 1: Put the Folder in the Right Place

Place the script folder in your server's resources directory. A tidy server uses category folders:

server-data/resources/[scripts]/script-name/

Folders in square brackets ([scripts], [esx], [maps]) are categories in FiveM. You can start everything inside one with a single line: ensure [scripts].

Three rules that matter:

  • Do not rename the folder. References inside the manifest and calls from other scripts depend on that exact name.
  • No spaces or special characters. Use bank-system, not bank system.
  • Case matters. On Linux servers MyScript and myscript are two different things. A config that works on Windows can throw "Could not find resource" on Linux.

If extracting produces a nested folder (for example script-name/script-name/fxmanifest.lua), move the inner folder up. fxmanifest.lua must sit directly inside the resource folder.

Step 2: Import the SQL File

If the script stores player data — banking, inventory, housing, vehicles — the archive includes a .sql file. Without importing those tables the script will not function.

Via phpMyAdmin: select your database → Import tab → choose the file → Go.

Via command line: mysql -u user -p database < script.sql

Back up your database first. Some SQL files contain DROP TABLE statements and can wipe existing tables — which means losing all your player data.

Step 3: Verify the Database Connection

Database access in FiveM goes through oxmysql. If it is installed, your server.cfg should contain a line like:

set mysql_connection_string "mysql://user:password@localhost:3306/database"

The DSN format works too:

set mysql_connection_string "user=user;password=password;host=localhost;port=3306;database=database"

Two practical notes: if your password contains ; , / ? : @ & = + $ # the connection may break — switch to the other format or simplify the password. And oxmysql must be started at the very top of your resource list.

Step 4: Add to server.cfg in the RIGHT ORDER

This is where most installations go wrong. FiveM loads resources in the order they appear in server.cfg, and a script must come after everything it depends on.

The correct order is:

  • ensure oxmysql — the database layer, before anything else
  • ensure ox_lib — the common helper library
  • ensure es_extended (ESX) or ensure qb-core (QBCore) — the framework
  • ensure [scripts] or individual ensure script-name lines — your scripts

The difference between ensure and start: start only launches a resource, while ensure restarts it if it is already running. Always use ensure in your server config.

Add one script at a time and restart. Adding five at once makes it far harder to work out which one broke.

Step 5: Match the Config to Your Server

Most scripts ship with config.lua or shared/config.lua. What usually needs adjusting: framework selection ('esx' / 'qb'), locale, job names, coordinates and prices.

If the framework setting is wrong, the script starts cleanly but does nothing — because it cannot reach player data. When commands do not respond, this is the first place to look.

Step 6: Test and Read the Errors

Restart the server or run restart script-name in the console. Then check two places:

  • txAdmin / server console — server-side errors, SQL failures and load-order problems appear here.
  • The F8 console in game — client-side Lua errors appear here.

Do not guess before reading the error. FiveM's output usually names the file and line number and points straight at the problem.

Practical Differences Between ESX and QBCore

The installation steps are identical on both, but a few differences are worth knowing.

On ESX: the framework resource is called es_extended. Scripts reach the player object through calls like ESX.GetPlayerFromId(). Function names changed between the older (1.1) and current (Legacy) versions, so check which one your script targets — if it does not say "ESX Legacy compatible", it may be written for the old version and will throw nil value errors.

On QBCore: the framework resource is qb-core and most official scripts carry the qb- prefix (qb-inventory, qb-banking). QBCore's scripts are more tightly coupled than ESX's; replacing the inventory script may force you to update everything that depends on it.

Common ground: both frameworks now lean on the ox_lib and oxmysql ecosystem. Most modern scripts list them as dependencies, so if they are not installed yet, install them first.

Common Errors and Fixes

  • "Could not find resource script-name": the folder name does not match server.cfg. Check letter case on Linux, and confirm the folder really is under resources.
  • "attempt to index a nil value (global 'ESX')": the framework loads after the script. Move ensure es_extended above it.
  • "No such export ... in resource oxmysql": oxmysql is not started, or starts after the script. Move it to the top.
  • SQL errors (Unknown column / Table doesn't exist): the .sql file was not imported, or went into the wrong database.
  • Script starts but commands do nothing: the framework setting in config.lua is wrong, or permissions are not defined.
  • Server crashes on startup: comment out the relevant ensure line with #, boot cleanly, and read the console logs.
  • Stuttering and low TPS: run resmon in the console to find the resource eating time. Usually a single badly written script slows the whole server.

Security: Watch Where Scripts Come From

Files from free script sites are not always innocent. Backdoored scripts are a persistent problem in the FiveM ecosystem — they can grant remote command execution on your server, let someone mint in-game money, or leak your database.

Before installing, look for: PerformHttpRequest calls to unknown addresses, encrypted blocks executed through load() or assert(load(...)), and absurdly long base64 strings. If you see any of these, do not install the script.

For general server hardening, see our guide on the first 10 steps to secure your server. We covered the equivalent process on the MTA side in how to add scripts to an MTA server.

FiveM Servers with Nubitro

Adding scripts is easy; running dozens of them smoothly is a hardware problem. Because the FiveM main loop runs largely on a single core, you want high clock speed — and NVMe storage so SQL queries return without lag. Nubitro's FiveM server packages come with instant setup, 200 Tbps+ DDoS protection and 24/7 support. If you want full control, look at our AMD Ryzen 9 based VDS options. If you have not set up your server yet, start with how to set up a FiveM server.

Frequently Asked Questions

I added the script but it does not show up. Why?

Check three things in order: is the folder actually under resources, is fxmanifest.lua directly inside it, and is the ensure line in server.cfg spelled correctly. If all three are fine, read the red lines in the console.

Will an ESX script run on QBCore?

No. The frameworks store player data, jobs and currency differently. Some scripts support both — you can tell from the framework option in config.lua. If it does not, you need a bridge resource or you have to adapt the script yourself.

What is the difference between ensure and start?

start launches a resource and does nothing if it is already running. ensure starts it if stopped and restarts it if running. Always prefer ensure in server.cfg.

How should I update a script?

Back up the current folder and your database first. Extract the new version and migrate your config.lua settings into the new file — do not copy the old config over wholesale, since new versions often add options. If the release notes mention SQL changes, import that file too.

How many scripts can I install?

There is no hard limit; your hardware and script quality are the limit. A hundred lightweight scripts can cost less than ten badly written ones. The metric is not the count but the millisecond figures in resmon.

How do I know a script is safe?

Open the files and search for suspicious patterns like PerformHttpRequest, load(, and long base64 blocks. Do not trust free scripts containing obfuscated (non-escrow) code. Where possible, try the script on a test server first.

Summary

  • Every script in FiveM is a resource and is invisible without a valid fxmanifest.lua.
  • Do not rename folders; letter case is a real source of failure on Linux.
  • Import the SQL file if there is one — and back up the database before you do.
  • Order in server.cfg is critical: oxmysql → ox_lib → framework → your scripts.
  • Add one script at a time; debugging gets dramatically easier.
  • Read errors from the console and F8 instead of guessing.
  • Check unknown scripts for backdoors before installing them.
Powered by WISECP
💬
Top