How to install FiveM scripts on your server
To install a FiveM script, download it, copy its folder into resources, import its SQL, add its items, and add an ensure line with its folder name to server, after the lines that start oxmysql, ox_lib and your framework.
The example is our Advanced Jail System V2 (tk_jail) on ESX, QBCore or Qbox. It is protected by Cfx.re Asset Escrow, so its Portal and server key steps fit any escrowed script.
You need the server files, server and access to the database.
Before you start
- A server that starts. ESX, QBCore or Qbox already runs. For a first server, follow Cfx.re’s server setup first.
- oxmysql. Download
oxmysqlfrom the oxmysql releases (2.14.3 on 19 October 2026). In.zip server,.cfg set mysql_comes before anyconnection_ string ensureline. If the password holds; , / ? : @ & = + $ #, the oxmysql docs say to change it or try the other string format. - ox_lib. Download
ox_libfrom the ox_lib releases (3.40.3 on 19 October 2026). The source code download must be built with bun before it runs; the release zip is ready..zip - The buying account and its key. An escrowed script runs only on a server whose
sv_licenseKeycomes from the Cfx.re account that owns the script. Tebex checkout signs you in with Cfx.re, so that is the account you bought with. - For tk_jail. The prison defaults to the Gabz Bolingbroke map, and the spots move 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. 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
To go back to an earlier release later, open the script in Granted Assets, select … for its version list and download the version 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 then fails to start. - Keep the folder name
tk_jail; it is the name yourensureline uses. 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 holds two blocks. The block under -- ESX: adds columns to the ESX users table. The block under -- QB: adds them to players, the table QBCore and Qbox both use. Run only the block for your framework; the other one fails on a table you do not have.
- 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 find it under “If it fails” before you run anything else.
Add the items
Every item a script gives or takes must exist in your inventory. tk_jail’s README lists its 32 items in two formats, and its web/images folder holds a PNG for each.
- 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 - Search the file for each name before you save, and keep one entry per name. A paste outside the table stops the server with a Lua error in
items, so copy the file first and put the copy back if that happens..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. In tk_jail these files stay open to edit: config, locales/*, client/, server/, client/ and server/.
- Set
Configon ESX, or.Framework = 'esx' 'qb'on QBCore and Qbox. 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. The shipped value is.ImagePath 'nui:/; on QBCore use/ ox_inventory/ web/ images' 'nui:/./ qb-inventory/ html/ images' - In
Config, list the jobs and lowest grades allowed to jail, lock up, release and open the Prison MDT. The default is.PoliceJobs policefrom grade 0.
Add the ensure lines in order
ensure starts a script, or restarts it if it already runs, and server starts scripts in the order of its lines. A script must 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 the order is:
ensure oxmysql
ensure ox_lib
ensure qbx_core
ensure ox_inventory
ensure tk_jail
On ESX, current esx_core’s server starts esx_lib, es_extended and then [core]; on QBCore, ensure qb-core and then ensure [qb]. A category line counts: if tk_jail sits in resources/[tk], the line ensure [tk] in that place starts it.
Do not add mysql-async. oxmysql declares provide 'mysql-async', so the @mysql-async/ line loads from oxmysql, and the oxmysql docs say to delete mysql-async and ghmattimysql.
Check it works
- Start the server and read the console from the top. No error line 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 in the inventory with its picture.
The next script goes in the same way, and its README names its own SQL and items; per-script answers are in the TK Scripts docs. If you are adding several of our scripts, compare the subscription plans before buying 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 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. |
