How to install FiveM scripts on your server
To install a FiveM script, you download it, copy its folder into resources, import its SQL and add its items. Then you add an ensure line with its folder name to server, after the lines that start oxmysql, ox_lib and your framework.
We’ll use our Advanced Jail System V2 (tk_jail) on ESX, Qbox or QBCore as the example. It’s protected by Cfx.re Asset Escrow, so the Portal and server key steps work the same for any escrowed script. You’ll need the server files, server and access to the database.
Before you start
- A server that starts. ESX, Qbox or QBCore is already running. If this is your first server, set it up first with Cfx.re’s server setup.
- oxmysql. Download
oxmysqlfrom the oxmysql releases (2.14.3 on 31 October 2026). In.zip server, the.cfg set mysql_line goes before anyconnection_ string ensureline. If your password contains any of; , / ? : @ & = + $ #, the oxmysql docs say to change it or try the other string format. - ox_lib. Download
ox_libfrom the ox_lib releases (3.41.0 on 31 October 2026). The release zip is ready to run. The source code download has to be built with bun first..zip - The buying account and its key. An escrowed script only runs on a server whose
sv_licenseKeycomes from the Cfx.re account that owns it. Tebex checkout signs you in with Cfx.re, so that’s the account you bought with. - For tk_jail. The prison defaults to the Gabz Bolingbroke map, and you can move its spots to any MLO in
config. The script also supports ox_inventory, qb-inventory, qs-inventory and ox_target..lua - A database backup. Export the database before the SQL step. If something goes wrong, restoring the export undoes the import.
Download the script from the Cfx.re Portal
- Sign in at portal.cfx.re with the account you used at checkout. Your scripts appear in your Cfx.re Portal account.
- Select Assets, then select the script under Granted Assets.
- Select Download and unzip the file. Find the
tk_jailfolder that hasfxmanifestdirectly inside it..lua
If you ever need an earlier release, open the script in Granted Assets, select … to see its versions and download the one you want (Cfx.re article, edited 10 June 2026).
Copy the folder into resources
- Stop the server.
- Copy
tk_jailinto theresourcesfolder of your server data. A folder in square brackets is a category, soresources/works too.[tk]/ tk_jail - Copy every file, including the
.fxapfile and hidden files. Some FTP programs skip hidden or protected files, and an escrowed script won’t start without them. - Keep the folder name
tk_jail, because yourensureline uses it. If the zip unpacked astk_jail/tk_jail, copy the inner folder, the one that holdsfxmanifest..lua
Import the SQL for your framework
tk_jail has two blocks. The one under -- ESX: adds columns to the ESX users table. The one under -- QB: adds them to players, which Qbox and QBCore both use. Run only your framework’s block. The other one fails, because you don’t have its table.
- In your database tool, such as HeidiSQL or phpMyAdmin, open the database named in
mysql_.connection_ string - Paste your framework’s block, from
ALTER TABLEto the closing;, and run it. The table gainsjail_items,jail_time,jail_typeandjail_cell, plusjail_cell_itemson ESX. - If the tool shows an error, stop and look it up under “If it fails” before you run anything else.
Add the items
Every item a script gives or takes has to exist in your inventory. tk_jail’s README lists its 32 items in two formats, and its web/images folder has a PNG for each one.
- On ox_inventory (ESX or Qbox), paste the
Items (ox_inventory)block intoox_inventory/, inside the table it returns. Copy the PNGs intodata/ items.lua ox_inventory/.web/ images - On QBCore, paste the
Items (qb-inventory)block intoqb-core/, insideshared/ items.lua QBCore. Copy the PNGs into.Shared .Items qb-inventory/.html/ images - Before you save, search the file for each name and keep one entry per name. Copy the file before you paste. A paste outside the table stops the server with a Lua error in
items, and putting the copy back fixes it..lua
On ESX without ox_inventory, items live in the database items table instead. Adding items to ox_inventory, QBCore and ESX shows the rows and the weight scale.
Set config.lua
Escrow encrypts most of the script, but in tk_jail these files stay open for you to edit: config, locales/*, client/, server/, client/ and server/.
- Set
Configon ESX, or.Framework = 'esx' 'qb'on Qbox and QBCore. Qbox runs QBCore scripts through its qb-core bridge, which itsqbx:enableBridgesetting turns on by default (Qbox docs). - Set
Configto.Inventory 'ox'for ox_inventory,'quasar'for qs-inventory, or'default'for the framework’s own inventory. - Set
Config. It ships as.ImagePath 'nui:/. On QBCore, use/ ox_inventory/ web/ images' 'nui:/./ qb-inventory/ html/ images' - In
Config, list the jobs, with the lowest grade in each, that can jail, lock up, release and open the Prison MDT. By default that’s.PoliceJobs policefrom grade 0.
Add the ensure lines in order
ensure starts a script, or restarts it if it’s already running. server starts scripts in the order of its lines, and a script has to start after everything it loads. tk_jail’s manifest loads @ox_lib/init and @mysql-async/, so oxmysql and ox_lib come first, then the framework and the inventory, then tk_jail. On Qbox that looks like this:
ensure oxmysql
ensure ox_lib
ensure qbx_core
ensure ox_inventory
ensure tk_jail
On ESX, esx_core’s own server starts esx_lib, es_extended and then [core]. On QBCore it’s ensure qb-core and then ensure [qb]. A category line works too: if tk_jail sits in resources/[tk], an ensure [tk] line in that spot starts it.
Don’t add mysql-async. oxmysql declares provide 'mysql-async', so the @mysql-async/ line loads from oxmysql. The oxmysql docs go further and say to delete mysql-async and ghmattimysql.
Check it works
- Start the server and read the console from the top. You shouldn’t see an error line that names tk_jail, oxmysql or ox_lib.
- In game, as a character with the
policejob, type/jailmdt. The Prison MDT opens. - As an admin, give yourself the tablet item:
/giveitem 1 prison_mdt 1on ox_inventory or qb-inventory, where1is your server ID. It shows up in your inventory with its picture.
Every other script goes in the same way, and its README names its own SQL and items. Answers for each script are in the TK Scripts docs. If you’re adding several of our scripts, compare the subscription plans before you buy them one by one.
If it fails
| Console or database line | Cause | Fix |
|---|---|---|
Couldn't find resource tk_jail. |
The ensure name and the folder name differ, or fxmanifest sits one folder deeper. |
Rename or flatten the folder, then restart. On a running server, refresh rescans resources before ensure tk_jail. |
You lack the required entitlement to use [asset name] |
The server key belongs to a Cfx.re account that does not own the script. | Follow you lack the required entitlement: use a key from the buying account, or transfer the script on the Portal. |
Failed to verify protected resource [resource name] |
The upload skipped the .fxap file or a hidden file. |
Copy the whole folder again with a program that copies hidden files. |
ox_lib must be started before this resource. |
ensure ox_lib is missing or comes after tk_jail. |
Put ensure ox_lib before the framework and tk_jail lines. |
Unknown column 'jail_items' in 'field list', or another jail_ column |
The SQL block was not run on this database. | Run your framework’s block on the database in mysql_. |
Table 'fivem, where fivem is your database |
You ran the -- QB: block on an ESX database. |
Run the -- ESX: block instead. ESX stores characters in users. |
Duplicate column name 'jail_items' |
The block already ran once. | Skip it. The columns are already there. |
attempt to call a nil value after an update |
A wrong Config, files from two versions mixed, or missing files. |
Install the folder fresh from the Portal, set the config again and clear the server cache and the client’s FiveM cache. |
| Props, vehicles or a map a script uses do not load | The model needs a newer game build than the server enforces. | Set sv_enforceGameBuild in server to the build the script or map names, such as sv_enforceGameBuild 3407. It applies only at startup. |
