W-DevelopmentW-Development
Frameworks Updated 12 min read

Writing scripts for Qbox (qbx_core)

Learn Qbox scripting: how qbx_core differs from QBCore, its exports API, multi-job groups, QBX.PlayerData, the ox stack and the QBCore bridge.

Overview

Qbox started as a fork of QBCore and became its own framework. It keeps QBCore’s data model — citizenid, PlayerData, jobs and gangs — but moves to an exports-based API, builds on ox_lib, ox_inventory and oxmysql, and adds multi-job support. If you know QBCore, Qbox is mostly new function names and cleaner patterns.

Qbox vs QBCore at a glance

TopicQBCoreQbox
Core accessexports['qb-core']:GetCoreObject()Direct exports: exports.qbx_core:GetPlayer()
Inventoryqb-inventory (or others)ox_inventory
UI helpersOwn menus and notifyox_lib
JobsOne job, one gangMultiple jobs and gangs, one primary
Old QB scripts—Mostly work through the built-in bridge

01Resource setup

fxmanifest.lualua
fx_version 'cerulean'
game 'gta5'
lua54 'yes'

shared_scripts {
    '@ox_lib/init.lua',
    '@qbx_core/modules/lib.lua',
}
client_scripts {
    '@qbx_core/modules/playerdata.lua',
    'client.lua',
}
server_script 'server.lua'

dependencies { 'qbx_core', 'ox_lib', 'ox_inventory' }

modules/lib.lua adds the qbx helper table (string, math and table utilities, plate helpers); modules/playerdata.lua gives the client a live QBX.PlayerData.

Server API

TaskExport
Get a playerexports.qbx_core:GetPlayer(source)
By citizen IDexports.qbx_core:GetPlayerByCitizenId(cid)
MoneyAddMoney(source, 'bank', n, reason), RemoveMoney, GetMoney
JobsSetJob(source, 'police', 2), AddPlayerToJob(cid, job, grade), SetJobDuty
Group checksHasGroup(source, 'police'), HasPrimaryGroup, GetGroups
Duty countGetDutyCountJob('police')
NotifyNotify(source, 'Saved', 'success')
MetadataSetMetadata(source, key, value), GetMetadata
server.lua — fish marketlua
local PRICE = 45
local MARKET = vec3(-1845.0, -1195.0, 14.3)

RegisterNetEvent('fishmarket:sell', function()
    local src = source
    if not exports.qbx_core:GetPlayer(src) then return end
    if #(GetEntityCoords(GetPlayerPed(src)) - MARKET) > 5.0 then return end

    local count = exports.ox_inventory:GetItemCount(src, 'fish')
    if count < 1 then
        return exports.qbx_core:Notify(src, 'You have no fish', 'error')
    end

    if exports.ox_inventory:RemoveItem(src, 'fish', count) then
        exports.qbx_core:AddMoney(src, 'cash', count * PRICE, 'fish-market')
        exports.qbx_core:Notify(src, ('Sold %d fish'):format(count), 'success')
    end
end)

Client side

client.lualua
RegisterCommand('myjob', function()
    local job = QBX.PlayerData.job
    lib.notify({ description = ('%s, grade %d'):format(job.label, job.grade.level) })
end, false)

RegisterNetEvent('QBCore:Client:OnJobUpdate', function(job)
    -- QBX.PlayerData is already updated; react here if needed
end)

Items and usable items

Define items in ox_inventory/data/items.lua. Make them usable through ox_inventory (a server.export or client export on the item) rather than the old QBCore pattern; exports.qbx_core:CreateUseableItem still exists for compatibility. See inventory integration.

Running QBCore scripts on Qbox

qbx_core ships a QBCore bridge, so scripts calling exports['qb-core']:GetCoreObject() usually keep working. New code should use the exports directly — the bridge exists for migration, not as the main API. The QBCore version of this example is in the QBCore tutorial.

Frequently asked questions

What is Qbox?

A FiveM roleplay framework that grew out of QBCore, built on ox_lib, ox_inventory and oxmysql with an exports-based API.

Do QBCore scripts work on Qbox?

Most do, through qbx_core’s built-in QBCore bridge.

How do I get player data on the client in Qbox?

Add '@qbx_core/modules/playerdata.lua' to your client scripts and read QBX.PlayerData.

How do I add money in Qbox?

exports.qbx_core:AddMoney(source, 'cash', amount, reason).

Can a player have two jobs in Qbox?

Yes. Players can belong to several jobs and gangs, with one primary job.

Need this built, not just explained?

Premium ESX, QBCore & Qbox scripts with instant delivery — or a custom resource, React NUI and the web stack around your server, built to spec.

Related guides