Cómo se hace

How to install QBCore in FiveM

Install QBCore step by step: requirements (FXServer + MySQL + oxmysql), downloading qb-core and the qb resources, the correct ensure order and how to get the CoreObject without errors.

The problem

You want to set up a QBCore server from scratch but you don't know which resources you need, in what order to load them or how to connect the database. A wrong order usually ends in "attempt to index a nil value (QBCore)".

The cause

QBCore is not a single resource: it's qb-core plus a family of resources (multicharacter, spawn, apartments, target, menu, input) that depend on oxmysql and a properly connected MySQL database. If oxmysql or qb-core don't load before the rest, the other resources start with no core and everything breaks.

The solution

The fastest and most reliable way is to use the official QBCore deployment recipe from txAdmin (it downloads the whole framework and creates the database for you). If you build it by hand, install oxmysql + qb-core + the qb resources, import the .sql files, set the MySQL connection string and respect this ensure order in server.cfg:

cfg
# server.cfgdatabase connection (oxmysql)
set mysql_connection_string "mysql://user:password@localhost/qbcore?charset=utf8mb4"

# ENSURE ORDER (critical): database first, then the core, then the rest
ensure oxmysql        # 1) database layer: ALWAYS first
ensure qb-core        # 2) the core: defines exports['qb-core']:GetCoreObject()

# 3) qb resources (they depend on qb-core, so they go after)
ensure qb-multicharacter
ensure qb-spawn
ensure qb-apartments
ensure qb-target
ensure qb-menu
ensure qb-input

# 4) from here on, your own resources
# ensure my_resource

Step by step

  1. 1.Prerequisites: have an up-to-date FXServer (artifacts), a MySQL/MariaDB server and create an empty database (for example `qbcore`).
  2. 2.Easy way (recommended): in txAdmin pick «Deployment» → QBCore recipe. It downloads qb-core and all the qb resources automatically and sets up the database for you.
  3. 3.Manual way: download oxmysql and qb-core, plus qb-multicharacter, qb-spawn, qb-apartments, qb-target, qb-menu and qb-input from the official Qbox/QBCore GitHub.
  4. 4.Import the .sql files from qb-core (and from each resource that ships its own) into your database with HeidiSQL, phpMyAdmin or `mysql < qb-core.sql`.
  5. 5.In server.cfg set `mysql_connection_string` with your user, password, host and database name.
  6. 6.Set the correct ensure order: oxmysql → qb-core → qb resources → your resources. Restart the whole server, not just a single resource.
  7. 7.In your scripts get the core with `local QBCore = exports['qb-core']:GetCoreObject()` (don't assume an empty global QBCore).

Different case?

Paste your error in the AI tool and get the fix instantly.

Try the tool

Related guides

Last updated: 2026-06-29. Crxative-M is not affiliated with Cfx.re or Rockstar Games.

How to install QBCore in FiveM (complete 2026 guide)