> ## Documentation Index
> Fetch the complete documentation index at: https://help.freakhosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# FiveM server.cfg Ensure Order: Resource Start Order Explained

> Get the FiveM server.cfg ensure order right: how resources start top to bottom, dependencies in fxmanifest.lua, category folders and a safe order to copy.

FiveM starts resources in the order of the `ensure` lines in `server.cfg`, from top to bottom. A resource must come **after** every resource it uses, so put libraries and the database (`oxmysql`) first, then your framework, then scripts, then maps and cars. A resource can also list `dependencies` in its `fxmanifest.lua`, which makes FiveM start those first.

| Difficulty | Time | Works on | Panel page |
| - | - | - | - |
| Intermediate | 10 minutes | Every FREAKHOSTING FiveM server | **Server config** > **Advanced: open the raw file**, **Resources** |

## Why does the ensure order matter?

Many scripts call functions (exports) of another resource as soon as they start. If that other resource hasn't started yet, you get errors such as "No such export" or a framework object that is `nil`, and the script doesn't work until you restart it.

Settings follow the same rule: put `set` and `setr` lines above the resources that read them, so the values are there when the resource starts. `exec` lines, such as vMenu's permissions file, also go above the resource that needs them.

## ensure, start, stop and restart

| Command | What it does |
| - | - |
| `ensure name` | Starts the resource, or restarts it if it is already running. Use this in `server.cfg`. |
| `start name` | Starts a stopped resource. |
| `stop name` | Stops a running resource. |
| `restart name` | Restarts a running resource. |
| `refresh` | Rescans the `resources` folder so new or changed resources can be started. |

All four resource commands also accept a category folder, for example `ensure [cars]` starts every resource in `resources/[cars]`. Details: [FiveM server commands](https://docs.fivem.net/docs/server-manual/server-commands/).

## A safe server.cfg ensure order

```cfg theme={null}
# 1. Settings first
setr voice_useNativeAudio true

# 2. Cfx.re base resources
ensure mapmanager
ensure chat
ensure spawnmanager
ensure sessionmanager
ensure basic-gamemode
ensure hardcap

# 3. Database
ensure oxmysql

# 4. Libraries other scripts use
ensure ox_lib

# 5. Framework
ensure qb-core

# 6. Framework scripts and other scripts
ensure [qb]
ensure [standalone]

# 7. Voice
ensure pma-voice

# 8. Assets: maps, cars, clothing
ensure [maps]
ensure [cars]
```

Use only the lines for resources you have. `qb-core` is an example: ESX uses `es_extended`, Qbox uses `qbx_core`. The base resources you see depend on how the server was set up.

> [!TIP]
>
> Inside a category folder such as `[qb]`, you don't control the order. If one script in a category needs another from the same category, `ensure` that one by name above the category line.

## How do dependencies in fxmanifest.lua work?

A resource can say what it needs in its `fxmanifest.lua`:

```lua theme={null}
dependencies {
    'oxmysql',
    'qb-core',
    '/server:4500',  -- needs at least server build 4500
    '/onesync',      -- needs OneSync
}
```

According to the [FiveM resource manifest reference](https://docs-backend.fivem.net/docs/scripting-reference/resource-manifest/resource-manifest), a dependency "requires the specified resource to load before the current resource". FiveM starts the listed resources first. If a listed resource doesn't exist, the resource that needs it doesn't start, and the console says which dependency is missing.

Not every script lists its dependencies, so a correct `ensure` order is still the safest way.

## How to change the order on FREAKHOSTING

**1. Open the raw server.cfg**

Go to **Server config** and click **Advanced: open the raw file**.

**2. Move the lines**

Cut and paste the `ensure` lines into the right order. Remove duplicate `ensure` lines for the same resource.

**3. Save and restart**

Click **Save Content** and restart the server. Read the console from the top for the first red error.

![FiveM Resources page showing resources with their category folder, a Start at boot toggle that adds or removes the ensure line in server.cfg, and a Delete button](https://mintcdn.com/freakhostingltd/oRNjFa_9Ix118Tkc/images/games/fivem/fivem-resources.png?fit=max\&auto=format\&n=oRNjFa_9Ix118Tkc\&q=85\&s=d801fd66daaeef927324873e2e82e9e8)

Start at boot on the Resources page adds or removes a resource's ensure line

The **Start at boot** switch on **Resources** adds or removes a resource's `ensure` line. After you switch on a resource that depends on others, check its position in the raw file. The file editor keeps a **History**, so you can go back to an earlier version.

> [!NOTE]
>
> If **Server config** shows the check **txAdmin runs this server**, txAdmin uses a `server.cfg` in another folder. Change the order there, in txAdmin's `server.cfg` editor or in **Files**.

## How do I fix start order errors without a restart?

While the server runs, you can start things in the right order from the **Console**:

```text theme={null}
ensure oxmysql
ensure qb-core
ensure myscript
```

Then fix the order in `server.cfg` so it is right at the next start. See [FiveM server console commands](https://help.freakhosting.com/games/fivem/fivem-server-console-commands.md).

## Frequently asked questions

### Should I use ensure or start in server.cfg?

Use `ensure`. It starts the resource, and if it is already running, it restarts it instead of doing nothing.

### Does the order of ensure lines really matter?

Yes. Resources start from top to bottom, and a script that uses another resource's exports at start-up fails if that resource isn't running yet.

### Where does oxmysql go in server.cfg?

Before your framework and every script that uses the database. The `set mysql_connection_string` line goes above `ensure oxmysql`.

### Can I ensure a whole folder?

Yes. `ensure [cars]` starts every resource in the `[cars]` category folder. The square brackets are part of the folder name.

### What does "No such export" mean?

A script called a function of a resource that isn't started, is started later, or has another name. Check the order and the spelling.

## Related guides

> **[FiveM server guide](https://help.freakhosting.com/games/fivem/fivem-server-hosting-guide.md)**
>
> Every FiveM guide in one place.

> **[Configure server.cfg](https://help.freakhosting.com/games/fivem/configuring-servercfg-for-fivem.md)**
>
> The Server config page and the raw file.

> **[Console commands](https://help.freakhosting.com/games/fivem/fivem-server-console-commands.md)**
>
> ensure, refresh, restart and more.

> **[Couldn't find resource](https://help.freakhosting.com/games/fivem/fivem-couldnt-find-resource.md)**
>
> Fix resources that don't start.

> **[Install QBCore or ESX](https://help.freakhosting.com/games/fivem/how-to-install-qbcore-or-esx-on-fivem.md)**
>
> Recipes write the order for you.

> [!NOTE]
>
> **Reviewed by the FREAKHOSTING team** on 29 October 2026. Game Panel steps were checked on our panel (FXServer build 35245 (Recommended) with txAdmin); game and plugin details follow their official documentation. Steps may differ slightly if FiveM, txAdmin or the resource change.

***

> [!NOTE]
>
> ### Need Extra Help?
>
> If you encounter any issues, our support team is ready to assist:
>
> * **Live Chat:** Quick assistance via our website.
> * **Support Ticket:** [Open a Ticket](https://freakhosting.com/clientarea/submitticket.php)
> * **Discord:** [Join our Community](https://discord.gg/freakhosting)
> * **Email:** [support@freakhosting.com](mailto:support@freakhosting.com)

> [!TIP]
>
> ### Save on Your Hosting
>
> Ready to upgrade your hosting? Use code **KB20** at checkout for **20% off** your first order!

***

**Last Updated:** October 2026


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.