Skip to main content
ScriptsCluster guide · 9 min read

How to Install a FiveM Script the Right Way

A clear, accurate walkthrough for installing any FiveM resource: where files go, how fxmanifest.lua works, the correct dependency order, ensure vs start, importing SQL, and handling escrow assets.

How to Install a FiveM Script (Correct Order)
Quick answer

To install a FiveM script, drop the resource folder into your server's resources directory, then start it from server.cfg with the ensure command. Always start dependencies first: oxmysql, then ox_lib, then your framework (ESX or QBCore), then the script that needs them. If the resource ships SQL, import it into your database before the first start, and authorize any escrow or keymaster assets to your server key.

On this page

What "installing a script" actually means

In FiveM, a script is not an app you double-click. It is a resource: a folder of Lua, JavaScript, or C# code plus a manifest file that tells the server what to load and in what order. Installing a resource means three things happen correctly: the files land in the right place, the server is told to start them, and any external requirements (a database table, a dependency, an authorized asset) are satisfied first.

Most "my script doesn't work" problems are not bugs in the script. They are ordering and wiring problems. Get the mechanics right and the vast majority of install failures disappear.

The resources folder and [categories]

Every FiveM server has a resources directory inside your server data folder (often called server-data). This is the only place the server scans for resources.

server-data/
  server.cfg
  resources/
    [standalone]/
    [framework]/
    [scripts]/
      my_script/
        fxmanifest.lua
        client.lua
        server.lua

Folders wrapped in square brackets like [scripts] are categories. A category is just an organizational bucket. The server recurses into bracketed folders to discover the resources inside them, so a resource inside [scripts]/my_script is found without any extra config. You can place one category inside another (for example [scripts]/[jobs]/my_job), but never put a fxmanifest.lua directly inside a bracketed folder. Brackets hold resources; they are not resources themselves.

The practical rule: keep your framework in [framework], shared libraries in [standalone] or [ox], and gameplay scripts in [scripts]. This keeps the load order readable later.

fxmanifest.lua: the file that defines the resource

Every resource needs a manifest. Modern servers use fxmanifest.lua (the older __resource.lua is deprecated). The manifest declares what the script is and which files to load:

fx_version 'cerulean'
game 'gta5'

author 'Quasar'
description 'Example resource'
version '1.0.0'

shared_scripts {
  '@ox_lib/init.lua',
  'config.lua'
}

client_scripts {
  'client/*.lua'
}

server_scripts {
  '@oxmysql/lib/MySQL.lua',
  'server/*.lua'
}

dependencies {
  'ox_lib',
  'oxmysql'
}

Two lines here do real work. The @resource/file.lua syntax pulls a file from another resource, which is how scripts hook into oxmysql and ox_lib. The dependencies block tells the server that those resources must be started for this one to run. If you edit a manifest, you must restart the resource for changes to take effect.

ensure vs start vs stop

You tell the server which resources to run inside server.cfg, line by line. There are three commands you will use:

  • start resource_name starts a resource once.
  • ensure resource_name starts it, and if it is already running, restarts it cleanly. ensure is idempotent and safe to leave in your config.
  • stop resource_name stops it.

Use ensure for everything in server.cfg. It behaves like start on a fresh boot but also lets you reload a single resource at runtime without a full server restart. From the live server console you can also type ensure my_script, restart my_script, or refresh (which rescans the resources folder so newly added resources become known before you start them).

The order of these lines in server.cfg is the load order. That is the part people get wrong.

Dependency order: the rule that fixes most failures

FiveM starts resources roughly in the order it reads them, and a resource that depends on another will fail if its dependency has not started yet. There is a reliable order that works for almost every modern script:

  1. oxmysql first. It is the database connector. Anything that touches MySQL needs it already running.
  2. ox_lib next. It is a shared library many scripts use for menus, notifications, callbacks, and caching.
  3. Your framework (ESX as es_extended, or QBCore as qb-core). Frameworks expose the player object, jobs, and money that gameplay scripts depend on.
  4. Framework-dependent scripts last. Anything that calls ESX or QBCore must start after the framework.

In practice your server.cfg reads top to bottom like this:

ensure oxmysql
ensure ox_lib
ensure es_extended
ensure my_job_script

If you put ensure my_job_script above ensure es_extended, the script boots, looks for the framework, finds nothing, and errors out. The fix is almost never editing code; it is moving one line.

SQL imports: do this before the first start

Many scripts store data (vehicles, inventories, properties) in MySQL. They ship a .sql file, usually in the resource root or a sql subfolder. The server will not import this for you. If the tables do not exist when the script first runs, you get errors like Table 'database.xyz' doesn't exist.

Import the SQL into the same database your mysql_connection_string convar points at, using HeidiSQL, phpMyAdmin, or the MySQL CLI:

mysql -u root -p your_database < my_script/install.sql

Do this before you ensure the script the first time. If a script's README mentions specific columns being added to the users or players table, run those ALTER statements too.

Escrow and keymaster assets

Many paid resources are protected by FiveM's asset escrow system. The code is encrypted and tied to your server's license key, which you generate on the Cfx.re keymaster portal and set in server.cfg as sv_licenseKey. Before an escrow-protected asset will run, you must authorize it to that key, usually by linking the asset in keymaster (for Tebex/Cfx purchases) or by entering the server key in the seller's portal.

Two things matter here. First, escrow encrypts the resource's core logic while leaving the manifest and any files the seller chose to expose (often config.lua) open to edit, so do not expect to edit the protected code. Second, if escrow authorization is missing you will see a clear console message telling you the asset is not entitled to this server. The fix is authorization, not reinstalling.

A clean install, start to finish

Put it together and a correct install looks like this: download the resource, unzip it, rename the folder to remove version numbers or -main suffixes, drop it into the right category in resources, import any SQL, add ensure lines to server.cfg in dependency order, authorize escrow if needed, then run refresh and ensure from the console or restart the server. Watch the console on first boot; it tells you exactly what failed and why.

Checklist
  • Download and unzip the resource
  • Rename the folder to a clean name (remove -main, version numbers, spaces)
  • Place it in the correct [category] inside resources
  • Open fxmanifest.lua and note its dependencies
  • Confirm oxmysql, ox_lib, and your framework are installed
  • Import any included .sql file into your database
  • Run any required ALTER statements on existing tables
  • Add ensure lines to server.cfg in dependency order
  • Set sv_licenseKey and authorize escrow assets in keymaster if paid
  • Run refresh then ensure from console, or restart the server
  • Read the live console output for errors on first start
Load order Resource Role Start before
1 oxmysql Database connector Everything that uses MySQL
2 ox_lib Shared library (menus, callbacks) Scripts that require ox_lib
3 es_extended / qb-core Framework (player, jobs, money) All gameplay scripts
4 your_script Gameplay resource Nothing (loads last)
Common mistakes

Wrong start order. Starting a script before its framework or oxmysql. Fix: in server.cfg, list oxmysql, then ox_lib, then the framework, then the script.

Missing dependency. The fxmanifest declares ox_lib or oxmysql but it is not installed or not started. Fix: install the dependency and ensure it above the script.

Not added to server.cfg. Files are in the resources folder but there is no ensure line, so nothing loads. Fix: add ensure resource_name to server.cfg, then refresh and ensure.

SQL not imported. Script runs but throws table-does-not-exist errors. Fix: import the included .sql file into the correct database before first start.

Bad folder name or wrong bracket placement. Spaces, version suffixes, or a fxmanifest placed directly inside a [bracketed] folder. Fix: clean the folder name and put the resource one level inside a category.

Escrow not authorized. Paid asset is not entitled to your server key. Fix: set sv_licenseKey and authorize the asset in keymaster, do not reinstall.

The Quasar take

Treat server.cfg as the single source of truth for load order. If you keep dependencies (oxmysql, ox_lib, framework) at the very top and everything else below, ninety percent of install tickets we see at Quasar would never get filed in the first place.

What is the difference between ensure and start in FiveM?
start runs a resource once. ensure runs it and, if it is already running, restarts it cleanly, so it is safe to leave in server.cfg and can reload a single resource at runtime. Use ensure for everything.
In what order should I start FiveM resources?
Start oxmysql first, then ox_lib, then your framework (es_extended or qb-core), then any script that depends on them. The order of ensure lines in server.cfg is the load order.
Why does my script say the framework is not found?
The script started before the framework. Move the framework's ensure line above the script's line in server.cfg, or add the framework to the script's dependencies block.
Do I need to import the SQL file myself?
Yes. The server does not run a resource's .sql file automatically. Import it into the database your connection string points at, before the first start, using phpMyAdmin, HeidiSQL, or the MySQL CLI.
What does asset escrow mean when installing a paid script?
Escrow encrypts the resource and ties it to your server license key. You must authorize the asset to your sv_licenseKey in the Cfx.re keymaster before it will run, and the core code stays uneditable.

Ready for the next step?

Stop guessing. Get a concrete plan for your server and move with confidence.

Written by
Kishi · FiveM Coach
Part of the FiveM Coach by Quasar team. We help server owners launch, fix, grow, and monetize stable RP cities.