01
What a resource contains
On FiveM, a "script" is a resource: a folder placed in resources, which the server starts by name. A job, an inventory, a garage, a HUD: each one is a resource, and its name is the name of its folder.
At the root of that folder there is always an fxmanifest.lua file, the manifest. It tells the server which files to load and what the resource needs:
fx_version 'cerulean'
game 'gta5'
shared_scripts {
'@ox_lib/init.lua',
'config.lua'
}
client_scripts {
'client/*.lua'
}
server_scripts {
'@oxmysql/lib/MySQL.lua',
'server/*.lua'
}
dependencies {
'ox_lib',
'oxmysql',
'es_extended'
}
fx_version and game: the manifest version (cerulean is the current one) and the target game, gta5 for FiveM, rdr3 for RedM.
client_scripts, server_scripts and shared_scripts: the code that runs on the player's side, on the server, or on both.
- A path starting with
@, such as @oxmysql/lib/MySQL.lua, loads a file from another resource, which must therefore be installed on the server.
dependencies: the resources that must be present and started before this one. The manifest can also require a minimum server version (/server: followed by a number), OneSync (/onesync) or a game build (/gameBuild:).
ui_page and files: the interface shown to the player and the files they download when connecting.
Next to the manifest you will often find a config.lua (the settings), a .sql file (the tables to create in the database) and a README. Read the README first, along with the dependencies section of the manifest: between them, they give the expected framework and the list of what to install beforehand.
A resource written for ESX does not run as is on QBCore, and vice versa: check compatibility before downloading or buying (see ESX, QBCore or Qbox). A resource shipped with a __resource.lua file instead of fxmanifest.lua uses the old manifest format: it is probably old and poorly maintained.
02
Copy the resource into the resources folder
Download the resource from its source: the author's GitHub repository, their post on the Cfx.re forum, or their store. On GitHub, take the archive from the Releases page when the author publishes one, rather than the source code download button: for resources such as ox_lib or ox_inventory, the source code must first be built (their web interface), whereas the release archive is ready to use.
Extract the archive on your computer, then check three things before uploading the folder to the server:
- The manifest is at the root: when you open the folder, you should see
fxmanifest.lua straight away. If you see a second folder with the same name, that is the one to upload.
- The folder has the right name: remove the
-main or -master suffix added by GitHub. The name must be exactly the one given by the author, because other resources call it by that name. No spaces or accented characters.
- The dependencies are there: every resource listed in
dependencies must be in resources too.
The resources folder sits next to server.cfg. Folders whose name is in square brackets are categories: they are only there to keep things tidy, and the server scans their contents. For example:
resources/
├── [core]/
│ ├── oxmysql/
│ ├── ox_lib/
│ └── es_extended/
└── [scripts]/
└── mon_script/
├── fxmanifest.lua
├── config.lua
├── client/
└── server/
Maps and interiors install the same way, with an extra stream folder: the guide installing an MLO covers that case.
03
Start the script with ensure in server.cfg
A folder sitting in resources does not start by itself. It needs an ensure line in server.cfg, placed after the resources the script depends on: the database, the libraries, the framework, then your scripts.
ensure oxmysql
ensure ox_lib
ensure es_extended
ensure mon_script
ensure starts the resource if it is stopped, and restarts it if it is already running. start only starts it: in a server.cfg, ensure is the usual choice.
ensure [scripts] starts every resource in a category at once. It is convenient, but you no longer choose the order inside the folder: keep separate lines for the database, the libraries and the framework.
- A resource declared twice, or present in two folders under the same name, causes behaviour that is hard to explain: one copy, one line.
Then restart the server. For a script with no database, you can also load it without stopping the server, from the console:
refresh
ensure mon_script
refresh makes the server rescan the resources folder, so it discovers new resources; ensure starts yours. The same ensure mon_script command reloads the script after a change to its config.lua. For a first install with tables to create and a framework to hook into, a full restart remains the safest option.
Add scripts one at a time, reading the console each time: when an error appears, you know where it comes from. The guide setting up a FiveM server details the other lines of server.cfg.
04
Import the SQL file and adjust the configuration
If the resource contains a .sql file, it needs tables in the server's database. Without them, the script starts and then throws errors on its first query. Back up the database first, then import the file into the database the server uses, the one in the mysql_connection_string line of server.cfg.
From the command line, on the machine running MariaDB:
mysql -u utilisateur -p mabase < mon_script.sql
With software such as HeidiSQL, connect to the database, select it, then run the SQL file. Two precautions:
- open the file before importing it: if it starts with a
CREATE DATABASE or USE line naming a database other than yours, remove that line, otherwise the tables end up somewhere else;
- import the file only once. When the script is updated, the author usually provides a separate file containing only the changes.
Then configure the resource:
- The
config.lua: the framework in use, the language, key bindings, map positions, in-game prices. A missing comma or brace in this file is enough to stop the script from starting: change a few things at a time.
- Items: many scripts add inventory items. Depending on your inventory, they are declared in the
items table of the database (ESX's original inventory), in qb-core/shared/items.lua (QBCore) or in ox_inventory/data/items.lua (ox_inventory). The README gives the lines to copy.
- The
server.cfg: some scripts need one more line, for example an add_ace to grant a permission to your admins.
The link between the server and the database, and its error messages, are covered in the oxmysql guide.
05
Escrow resources bought from a store
Many paid scripts go through Cfx.re's Asset Escrow: part of the files is encrypted, and the resource only starts on a server whose licence key belongs to the buyer's Cfx.re account. Installation follows the same steps as above, with four specifics.
- The download: after the purchase, the resource appears among your account's assets on the Cfx.re portal, which replaced Keymaster. Download it from your own account, never from a link someone passes on to you.
- The right account: the server's
sv_licenseKey must come from the account that owns the resource. If the purchase was made on another account, the portal lets you transfer it to the right one, once only.
- The
.fxap file: every protected resource contains this file, often hidden. Some transfer programs do not copy hidden files: check that it reached the server, at the root of the resource.
- Recent artifacts: escrow requires server version 5181 or above. An up-to-date server does not need to worry about it.
Encrypted files cannot be read or edited. The author leaves in plain text the ones they want you to adjust, usually config.lua and the translations.
Beware of "leaked" versions of paid scripts handed out for free: they often contain a backdoor that gives a stranger control of your server, and using them breaks Cfx.re's terms. Creating the key and what it does are explained in the guide FiveM licence key.
06
Common errors
The server console almost always gives the cause. The messages that come up most often:
Couldn't find resource mon_script.: the name on the ensure line matches no folder. A typo, a leftover -main suffix, a folder uploaded to the wrong place, or a folder inside a folder.
Could not open resource metadata file: the folder exists but has no fxmanifest.lua at its root. Same cause: the archive was extracted one level too high.
Could not find dependency ox_lib for resource mon_script.: a resource listed in dependencies is not installed, or its folder has a different name. Install it, then restart.
Couldn't start resource mon_script.: the server found the resource but could not launch it. The reason is written in the lines just above.
No such export … in resource …: the script calls a function from another resource that is not started, starts after it, or is not at the expected version. Move that resource's ensure line up and update it.
SCRIPT ERROR: @mon_script/server/main.lua:42: attempt to index a nil value: an error in the code, with the file and the line. It most often comes from the wrong framework selected in config.lua, a syntax error in that file, or a dependency that is too old.
Table '…' doesn't exist (or ER_NO_SUCH_TABLE): the .sql file was not imported, or not into the right database.
You lack the required entitlement to use mon_script: an escrow resource and a licence key from another account. Check the key, transfer the purchase if needed, then fully restart the server.
Failed to verify protected resource: files were damaged or left out during the transfer, often the .fxap. Upload the complete resource again, hidden files included.
The script starts without errors but nothing happens in game? Open the game console with F8: client-side errors show up there, whereas the server console only shows the server side. Also check that the script does not require a specific game build (sv_enforceGameBuild) or OneSync. Once the script is in place, the resmon 1 command, in that same F8 console, shows what it consumes.
07
On a CloudFive server
On a FiveM plan, installing a script is done from the server's page in the customer area:
- Create a backup before adding the script. Backups are dated, cover the database too and restore in one click, after confirmation: if the script breaks something, you roll back.
- Upload the resource to
resources with the file manager: drag and drop, archive handling, or import from a URL, handy for a release link.
- Prepare the database: MariaDB databases, whose number depends on the tier, are created and managed from the customer area. Import the
.sql file into the one the server uses, the one in mysql_connection_string.
- Add the
ensure line to server.cfg, which can be edited from the customer area or from the editor in txAdmin, included on every plan.
- Restart and read the console, shown live on the server's page. The page lists which resources are started or stopped, and a diagnostic reads the last console lines to flag a resource in error.
A few points specific to our plans:
- Framework first: ESX Legacy, QBCore or Qbox install in one click, with the database created and filled and
server.cfg completed. This install replaces the server's contents, after a backup: do it before adding your scripts, not after.
- Artifacts: the page shows the installed version and lets you switch to another or go back to the previous one, if a script needs a newer version or an update breaks one.
- Escrow resources: the licence key is set when the server is created, whereas an escrow resource requires a key from the buyer's Cfx.re account. If you plan to buy some, ask support before buying.
- If you are stuck: the ticket is opened from the server's page, with the context already filled in. Support answers in French, 7 days a week.
The servers run in France on Ryzen 9 9950X, with Anti-DDoS Premium included, billed monthly with no commitment. The tiers are on the FiveM hosting page.
08
Frequently asked questions
How do I install a script on a FiveM server?
Copy the script's folder into resources, install the resources listed in the dependencies section of its fxmanifest.lua, import its .sql file into the database if it has one, add ensure followed by the folder name to server.cfg, after the framework, then restart the server and read the console.
Where do scripts go on a FiveM server?
In the resources folder, next to server.cfg. You can sort them into subfolders in square brackets, such as [scripts]: these are categories, which the server scans. The fxmanifest.lua file must sit directly at the root of the script's folder.
What is the difference between start and ensure on FiveM?
start starts a stopped resource. ensure starts it if it is stopped and restarts it if it is already running. In server.cfg, ensure is the usual choice, and both commands also accept a category, for example ensure [scripts].
Why does my FiveM server say Couldn't find resource?
The name written after ensure matches no folder in resources: a typo, a -main suffix left by GitHub, a folder uploaded to the wrong place, or a folder nested inside another folder with the same name. Fix the name or the location, then restart.
How do I fix You lack the required entitlement on FiveM?
The resource is protected by Asset Escrow and the server's licence key does not belong to the Cfx.re account that bought it. Use a key from that account, or transfer the purchase to the right account from the Cfx.re portal (once only), then fully restart the server.
Do I need to restart the FiveM server to install a script?
Not always. In the console, the refresh command makes the server rescan the resources folder, then ensure followed by the script name starts it. For a first install with an SQL file and a framework, a full restart is safer.