In short
To convert an ESX script to QBCore, you replace framework calls with their equivalents: GetCoreObject instead of getSharedObject, Functions.GetPlayer instead of GetPlayerFromId, AddMoney('cash') instead of addMoney, AddItem instead of addInventoryItem, and CreateCallback instead of RegisterServerCallback. Identifier and users references in SQL must become citizenid and players, and item and job definitions must move into the shared files.
In this guide
Converting an ESX script to QBCore means changing the lines where the script talks to the framework, not its game logic: getting the core object, the player object, money, inventory, jobs, callbacks and event names. In this guide we give you one-to-one equivalents for these functions in tables, walk through a real conversion example and list the spots people miss most often.
Before you start converting
ESX and QBCore do the same job with different data models. ESX stores players by identifier in the users table; QBCore generates a citizenid for each character and uses the players table. Money types, job grades and item definitions also live in different places. That's why "find and replace" conversions often don't throw errors at startup but cause silent bugs in game, like money not being deducted or items not being given.
If you haven't weighed the general differences between the two frameworks yet, we recommend reading our ESX vs. QBCore vs. QBox comparison. Before you begin:
- Make sure the script isn't encrypted with escrow; encrypted files can't be converted, and only bridge files left open can be adapted.
- Back up the original folder and do the conversion on a separate test server.
- Note the script's SQL file and its
fxmanifest.luadependencies.
ESX to QBCore function equivalents
Core object and player
| Action | ESX | QBCore |
|---|---|---|
| Get the core object | exports['es_extended']:getSharedObject() | exports['qb-core']:GetCoreObject() |
| Player object (server) | ESX.GetPlayerFromId(src) | QBCore.Functions.GetPlayer(src) |
| Persistent ID | xPlayer.identifier | Player.PlayerData.citizenid |
| Player data (client) | ESX.GetPlayerData() | QBCore.Functions.GetPlayerData() |
| Player loaded (client event) | esx:playerLoaded | QBCore:Client:OnPlayerLoaded |
| Job changed (client event) | esx:setJob | QBCore:Client:OnJobUpdate |
Money
| Action | ESX | QBCore |
|---|---|---|
| Read cash | xPlayer.getMoney() | Player.PlayerData.money.cash |
| Add cash | xPlayer.addMoney(n) | Player.Functions.AddMoney('cash', n, 'sebep') |
| Remove cash | xPlayer.removeMoney(n) | Player.Functions.RemoveMoney('cash', n, 'sebep') |
| Read bank | xPlayer.getAccount('bank').money | Player.PlayerData.money.bank |
| Add to bank | xPlayer.addAccountMoney('bank', n) | Player.Functions.AddMoney('bank', n, 'sebep') |
| Dirty money | xPlayer.addAccountMoney('black_money', n) | No default account; the markedbills item is usually used |
Inventory and items
| Action | ESX | QBCore |
|---|---|---|
| Give item | xPlayer.addInventoryItem(ad, adet) | Player.Functions.AddItem(ad, adet) |
| Remove item | xPlayer.removeInventoryItem(ad, adet) | Player.Functions.RemoveItem(ad, adet) |
| Item count | xPlayer.getInventoryItem(ad).count | Player.Functions.GetItemByName(ad) and .amount |
| Usable item | ESX.RegisterUsableItem(ad, fn) | QBCore.Functions.CreateUseableItem(ad, fn) |
| Item definition | Database items table (classic ESX) | qb-core/shared/items.lua |
Jobs, callbacks and notifications
| Action | ESX | QBCore |
|---|---|---|
| Job name | xPlayer.job.name | Player.PlayerData.job.name |
| Job grade | xPlayer.job.grade | Player.PlayerData.job.grade.level |
| On duty | No default | Player.PlayerData.job.onduty |
| Define server callback | ESX.RegisterServerCallback(ad, fn) | QBCore.Functions.CreateCallback(ad, fn) |
| Trigger callback (client) | ESX.TriggerServerCallback(ad, cb, ...) | QBCore.Functions.TriggerCallback(ad, cb, ...) |
| Notification (client) | ESX.ShowNotification(msg) | QBCore.Functions.Notify(msg, 'success') |
| Notification (server) | xPlayer.showNotification(msg) | TriggerClientEvent('QBCore:Notify', src, msg, 'error') |
Example: Converting a selling script
Below is simple ESX server code that sells the fish a player is carrying:
ESX = exports['es_extended']:getSharedObject()
RegisterNetEvent('balikci:sat', function()
local xPlayer = ESX.GetPlayerFromId(source)
if not xPlayer then return end
local item = xPlayer.getInventoryItem('fish')
if item and item.count > 0 then
local kazanc = item.count * 25
xPlayer.removeInventoryItem('fish', item.count)
xPlayer.addMoney(kazanc)
xPlayer.showNotification(('%d$ kazandiniz'):format(kazanc))
end
end)
The same logic in QBCore:
local QBCore = exports['qb-core']:GetCoreObject()
RegisterNetEvent('balikci:sat', function()
local src = source
local Player = QBCore.Functions.GetPlayer(src)
if not Player then return end
local item = Player.Functions.GetItemByName('fish')
if item and item.amount > 0 then
local adet = item.amount
local kazanc = adet * 25
if Player.Functions.RemoveItem('fish', adet) then
Player.Functions.AddMoney('cash', kazanc, 'balik-satisi')
TriggerClientEvent('QBCore:Notify', src, ('%d$ kazandiniz'):format(kazanc), 'success')
end
end
end)
Note the differences: amount instead of count, the money type passed explicitly as 'cash', and the result of RemoveItem being checked. That last point matters; if the item couldn't be removed, no money should be paid out, or you create a money duplication exploit on your server.
Also, if fxmanifest.lua has ESX lines like shared_script '@es_extended/imports.lua', remove them and update the dependency:
dependencies {
'qb-core'
}
Converting callbacks
Callbacks, where the client requests data from the server, are another common pattern. The ESX version:
-- server
ESX.RegisterServerCallback('balikci:fiyat', function(source, cb, adet)
cb(adet * 25)
end)
-- client
ESX.TriggerServerCallback('balikci:fiyat', function(fiyat)
ESX.ShowNotification(('Toplam: %d$'):format(fiyat))
end, 10)
The QBCore equivalent has the same structure; only the function names change:
-- server
QBCore.Functions.CreateCallback('balikci:fiyat', function(source, cb, adet)
cb(adet * 25)
end)
-- client
QBCore.Functions.TriggerCallback('balikci:fiyat', function(fiyat)
QBCore.Functions.Notify(('Toplam: %d$'):format(fiyat), 'primary')
end, 10)
If ox_lib is installed on your server, switching to the framework-agnostic lib.callback.register and lib.callback.await functions also makes it easier to move to another framework later.
Recommended conversion order
- Manifest: Remove ESX imports and dependencies and add
qb-core. - Core object: Replace
ESXdefinitions withQBCorein every file. - Server side: Convert player, money, item and job calls using the equivalents in the tables.
- Client side: Convert event names, player data reads and notifications.
- Database: Adapt the SQL file and queries to the
citizenidstructure; add items and jobs to the shared files. - Verify with search: When you're done, check that no lines containing
ESX,xPlayeroresx:remain in the folder:
# Linux
grep -rnE "ESX|xPlayer|esx:" resources/balikci/
# Windows PowerShell
Get-ChildItem -Path .\resources\balikci -Recurse -Include *.lua | Select-String -Pattern 'ESX','xPlayer','esx:'
9 things most often missed when converting
- SQL queries: Queries that reference
usersandidentifiermust change toplayersandcitizenid.ownercolumns in the script's own tables must also be updated to store the citizenid. We cover the database side in our oxmysql and MariaDB guide. - Item definitions: Items that live in the database in ESX must be added to
shared/items.luain QBCore, orAddItemfails. - Job grade type:
job.gradeis a number in ESX but a table in QBCore. A comparison likeif job.grade >= 2must usejob.grade.level. - Job definitions: Jobs stored in the
jobsandjob_gradestables in ESX must move to theshared/jobs.luafile in QBCore. - The source variable:
sourcecan get lost in callbacks and nested functions; uselocal src = sourceon the first line of the event. - Client event names: Code listening for
esx:playerLoadednever fires in QBCore, and it doesn't throw an error either. - Dirty money: Code that writes to the
black_moneyaccount must be adapted to an item-based system in QBCore. - Inventory system: If your server uses ox_inventory or a different inventory, item operations must use that inventory's exports. The names of visual events like the item box (ItemBox) also vary by inventory version.
- If you use QBox: QBox provides a QBCore compatibility layer, but using its own exports is the better choice for new code.
A cleaner approach: A bridge file
If you're writing a script that should run on multiple frameworks, collecting framework calls in a single bridge.lua file makes maintenance easier. For example, you write a function called Bridge.AddMoney(src, n) and inside it check which framework is loaded with GetResourceState('qb-core') == 'started'. That way only this file gets adapted, and the game logic never changes.
A simple bridge skeleton looks like this:
Bridge = {}
local QBCore, ESX
if GetResourceState('qb-core') == 'started' then
QBCore = exports['qb-core']:GetCoreObject()
elseif GetResourceState('es_extended') == 'started' then
ESX = exports['es_extended']:getSharedObject()
end
function Bridge.AddMoney(src, miktar)
if QBCore then
local Player = QBCore.Functions.GetPlayer(src)
return Player and Player.Functions.AddMoney('cash', miktar, 'bridge')
elseif ESX then
local xPlayer = ESX.GetPlayerFromId(src)
if xPlayer then xPlayer.addMoney(miktar) return true end
end
return false
end
Testing checklist
- Are there no errors in the server console or F8?
- Do money and item operations behave correctly in both success and failure cases (not enough items, full inventory)?
- Does data persist when a player logs out and back in?
- Do job-restricted menus open at the correct grade?
- Did the resmon value go up after the conversion?
Speed up the conversion or hand it off
The tables above are enough for small scripts, but changing every line by hand in a system with dozens of files takes hours. Giving the mappings from the tables to an AI assistant as context and converting file by file cuts that time significantly. If you're converting several large scripts, the AI Developer Pro + plan with 3M token capacity is a good fit for that workload. You'll find how to review AI-generated code in our guide to writing FiveM scripts with AI.
For complex systems deeply tied to the economy, database or inventory, handing the job to a developer is the safer option. With OyunBulut's FiveM Developer Service, you can send the scripts to convert along with your framework version and have the conversion done for you.
What's next
Start by converting a single small script with the tables in this guide and testing it on a test server; once you've nailed the pattern, move on to the rest. If you want to move faster, compare the AI Developer plans and the developer service and choose the one that fits your workload.
Frequently asked questions
Will an ESX script run on QBCore without any changes?
Usually not. The core object, player, money and inventory functions are different, so at a minimum the framework calls need to be adapted.
What is the QBCore equivalent of the ESX identifier?
QBCore generates a citizenid for each character and stores players in the players table. Identifier references in the script's SQL queries must be replaced with citizenid.
How do you use black_money in QBCore?
QBCore has no default dirty money account. Instead, the markedbills item with a value stored on the item is most commonly used.
Can I convert an escrowed ESX script to QBCore?
Encrypted files can't be edited. Only the bridge or editable files the developer left open can be adapted; otherwise you should ask the seller for a QBCore version.
Why isn't my converted script giving items?
Most likely the item isn't defined in qb-core/shared/items.lua, or your server uses a different inventory system. Check the item definition and the inventory exports.