# How to Add Scripts to a FiveM Server (Resources, ensure, Dependencies)

Add scripts to a FiveM server: upload the resource folder to resources, add ensure to server.cfg after its dependencies, import its SQL and restart.

Updated 2026-10-03. https://gamezservers.com/guides/how-to-add-scripts-to-a-fivem-server

To add a script to a FiveM server, upload its folder (the one with `fxmanifest.lua` directly inside) into the server's `resources` folder, add `ensure foldername` to `server.cfg` below the scripts it depends on (such as `oxmysql`, `ox_lib` or your framework), import any `.sql` file it ships into your database, and restart. The resource name is the folder name, so rename `script-main` from a GitHub download to the name the script expects.

## What you are working with

| File or folder | What it does |
| --- | --- |
| `resources/` | Every folder in here is a resource FiveM can start |
| `resources/[category]/` | Folders in square brackets are categories that hold several resources, not resources themselves |
| `fxmanifest.lua` | The resource's manifest: which client and server files load, and its `dependencies` |
| `config.lua` | Most scripts' settings: framework choice, prices, locations |
| `.sql` file | Database tables the script needs, imported once |
| `server.cfg` | Where `ensure` lines decide which resources start, and in which order |
| Escrowed files (`.fxap`) | Paid scripts locked to the Cfx.re account that bought them |

The [FiveM resource docs](https://docs.fivem.net/docs/scripting-manual/introduction/introduction-to-resources/) put it in one line: any folder in `resources` is a resource, except folders in `[brackets]`, which are categories.

![A muscle car chased by a police cruiser through a Los Santos alley, the kind of gameplay FiveM scripts add jobs and rules to](https://gamezservers.com/games/fivem/shot-5.jpg)

## Before you start

- **Back up the server.** Scripts can add database tables and change player data.
- **Check the framework.** A script written for QBCore does not run on ESX unless it says it supports both. Qbox runs most QBCore scripts through its compatibility layer, but check the script page.
- **Read the dependencies.** The script's page or `fxmanifest.lua` lists them. `oxmysql` and `ox_lib` are the most common. Install those first.
- **Stop the server** before uploading big resources, so nothing half loads.

## Step 1: Get the right folder

Unzip the download on your PC and find the folder that has `fxmanifest.lua` directly inside it. That folder is the resource. Downloads often wrap it in an extra folder, such as `my-script-main/my-script/fxmanifest.lua`, and uploading the outer folder is the most common reason a script never starts.

## Step 2: Name the folder correctly

FiveM uses the folder name as the resource name. GitHub's **Download ZIP** adds the branch to the folder name, so `qb-garages` arrives as `qb-garages-main`. Rename it to `qb-garages`. Other scripts call resources by name, for example with `exports['ox_lib']`, and a folder called `ox_lib-main` breaks every script that depends on it.

## Step 3: Upload it to resources

Upload the folder into `resources`, ideally inside a category folder so the list stays tidy:

```
resources/
  [standalone]/
    my-script/
      fxmanifest.lua
      config.lua
      client/
      server/
```

On a txAdmin recipe, the server data folder (with `server.cfg` and `resources`) is the one txAdmin deployed the recipe into. For a resource with hundreds of files, upload it as a zip and extract it on the server, or use SFTP.

## Step 4: Import the SQL

If the script includes a `.sql` file, run it against your server's database once, using a tool like HeidiSQL or the database panel your framework uses. Skipping it is why many scripts start fine and then throw `Table doesn't exist` errors as soon as a player uses them.

## Step 5: Add ensure in the right order

Open `server.cfg` and add a line for the new resource:

```
ensure oxmysql
ensure ox_lib
ensure qb-core
ensure my-script
```

Order matters: a resource must start after everything it depends on. Put framework resources near the top and your own scripts below them. You can also start a whole category at once with `ensure [standalone]`, which starts every resource in that folder.

`ensure` starts a resource, or restarts it if it is already running. `start` only starts it. Use `ensure`.

## Step 6: Restart and check the console

Restart the server and read the console as it starts. A healthy resource prints `Started resource my-script`. While testing on a running server, `refresh` reloads the resource list and `ensure my-script` starts the new one without a full restart.

## Paid scripts are locked to one Cfx.re account

This is the trap behind most "the script I paid for will not load" questions. Paid scripts from Tebex usually use FiveM's asset escrow: their files are encrypted, and they only run on a server whose **license key was made on the same Cfx.re account that bought the script**. Upload it to a server whose key belongs to a friend or an old account and the console prints `You lack the required entitlement`.

To fix it, either create the server's license key on the account that owns the script (in the Cfx.re portal at portal.cfx.re), or transfer the script to the account whose key the server uses. Asset transfers are limited, so pick the right account. Also download escrowed scripts from your own Cfx.re account after buying, never from a copy someone sends you. Leaked copies are against the [FiveM terms](https://fivem.net/terms) and are a common source of backdoors.

## Common problems

- **"Couldn't find resource my-script":** the folder name does not match the `ensure` line, or the folder is nested one level too deep.
- **"Could not find dependency":** a resource it needs is missing or starts later. Install it and move its `ensure` above.
- **Script loads but nothing happens in game:** the framework in `config.lua` is wrong (set to `esx` on a QBCore server, for example), or the script's item or job was never added to the framework's shared files.
- **"Table doesn't exist" in the console:** the script's SQL file was never imported.
- **"You lack the required entitlement":** the license key belongs to a different Cfx.re account than the one that bought the script.
- **Server hitches after adding scripts:** check `resmon` in the F8 console for the resource using the most time. See [FiveM lag and hitch warning fixes](https://gamezservers.com/guides/fivem-server-lag-and-hitch-warning-fix).

## Adding scripts on GamezServers

On a [GamezServers FiveM server](https://gamezservers.com/games/fivem), upload scripts in the **Files** tab (zip upload and extract work there, and so does downloading a release straight from its link to the server) or over the SFTP login in **Settings**, edit `server.cfg` in the browser, and restart from txAdmin. Your server comes with its own MySQL database, with the login details in **Settings** for HeidiSQL. Press **Backup** before adding a big script. Looking for scripts? Start with [the best free FiveM scripts](https://gamezservers.com/guides/best-free-fivem-scripts).

## FAQ

### Where do I put scripts on a FiveM server?

In the `resources` folder of your server data folder, one folder per script, with `fxmanifest.lua` directly inside each one.

### Do I need to restart the server after adding a script?

A restart is safest. On a running server you can type `refresh` and then `ensure scriptname` in the console to start it.

### Why does my FiveM script say it couldn't find the resource?

The folder name does not match the name in `ensure`, often because GitHub added `-main` to it, or the script folder sits inside another folder.

### Can I use QBCore scripts on ESX?

Only if the script supports both. Many scripts have a framework option in `config.lua`, but a QBCore only script needs QBCore.
