Fix it, then get back to your server.
Step-by-step fixes for the errors FiveM server owners hit most: ESX, QBCore, QBox, oxmysql and more. Tested, with the code to copy.
Errors & fixes
Could not find dependency X for resource Y: how to fix itFiveM says Could not find dependency ox_lib for resource Y? What dependency in fxmanifest.lua means, how to install the missing resource, folder naming and start order.
Couldn't start resource: why FiveM won't start your scriptCouldn't start resource X or Failed to start resource in your FiveM console? The usual causes (manifest, folder name, Lua error, dependency, escrow) and how to find yours.
You lack the required entitlement to use a resource: escrow fixEscrowed FiveM script says you lack the required entitlement or failed to verify? Match your server license key to the Cfx.re account that owns the asset.
ESX is nil: fixing esx:getSharedObject in ESX Legacyattempt to index a nil value (global 'ESX')? The old esx:getSharedObject event is gone from ESX Legacy. Here is the one-line fix, and what to do with scripts you cannot edit.
attempt to index a nil value (local 'xPlayer'): ESX fixxPlayer is nil in your ESX script? Why ESX.GetPlayerFromId(source) returns nil: player not loaded, source lost after Wait, string ids, playerDropped. With guard patterns.
FiveM json.decode error: nil, empty string and invalid JSON fixesjson.decode fails or returns nil in your FiveM script? Why decoding nil, empty or hand-edited JSON breaks, what json.encode does to mixed keys, and how to use pcall safely.attempt to call a nil value (field, global, method): how to fix it · attempt to compare number with nil / arithmetic on a nil value: fix · bad argument #1 to 'X' (number expected, got nil): FiveM Lua fix · Lua syntax error: unexpected symbol near, 'end' expected (FiveM) · table index is nil / index a nil value (field): FiveM Lua fix · No such export getSharedObject in resource es_extended: the fix · No such export X in resource Y: how to fix it in FiveM · @ox_lib/init.lua not found and ox_lib errors: how to fix · oxmysql can't connect: ECONNREFUSED, access denied, unknown database · attempt to index a nil value (global 'QBCore'): the GetCoreObject fix · attempt to index a nil value (local 'Player'): QBCore and QBox fix · How to read a FiveM SCRIPT ERROR: file, line and stack trace · Reliable network event overflow in FiveM: find the script and fix it · FiveM sv_licenseKey: 'no license key was specified' error fix · server thread hitch warning: timer interval of X milliseconds, fix · Table 'db.x' doesn't exist and Unknown column: import the SQL file
Server setup
How to back up a FiveM server: database, resources and txDataBack up your FiveM server: mysqldump or HeidiSQL for the database, resources, server.cfg and txData, scheduled backups, off-server copies and how to restore.
How to set up a FiveM server on Linux: artifacts, systemd and ufwRun a FiveM server on Ubuntu or Debian: download the artifact, extract it, start run.sh with txAdmin or server.cfg, keep it alive with screen or systemd, open ports with ufw.
FiveM server git: what to commit, .gitignore and git pull deploysPut your FiveM server under git the safe way: what to commit, a .gitignore for cache and txData, keeping keys out with a secrets.cfg, private repos and git pull deploys.
FiveM server hosting requirements: CPU, RAM, disk and networkWhat to rent for a FiveM server: why single-thread CPU speed matters most, RAM by player count, NVMe, DDoS protection, Windows or Linux, location and hosting types.
FiveM server not showing or players can't connect: port 30120 fixYour FiveM server is not in the list, or players time out when they connect. Open port 30120 for TCP and UDP in the firewall and router, and test with F8 connect.
How to enable OneSync and raise the FiveM player limit above 32Your FiveM server will not go past 32 players, or sv_maxclients is ignored. How to turn on OneSync in server.cfg or txAdmin, set sv_maxclients, and check it works.pma-voice not working: players can't hear each other on FiveM · FiveM resmon high ms: how to find and fix slow scripts · server.cfg explained: every FiveM server.cfg line, one by one · server.cfg ensure order: the right resource start order for FiveM · FiveM server icon, banner, tags and colours: improve your listing · FiveM DLC cars, clothes or maps missing? Set sv_enforceGameBuild · txAdmin forgot password: reset the master account and get back in · txAdmin setup and recipes: deploy a FiveM server step by step · txAdmin scheduled restarts: set a daily restart with warnings · Outdated FiveM server artifacts: how to update FXServer safely
ESX, QBCore & QBox
Convert an ESX script to QBCore (and back): function map and bridgePort a FiveM script between ESX and QBCore: a table of the common calls (player, money, job, items, notifications, callbacks) and a bridge file that supports both.
Convert a QBCore script to QBox: qbx_core, ox_inventory, ox_targetHow to port a QBCore script to QBox: the qbx_core compatibility layer, GetPlayer, ox_inventory items, ox_lib notify and progress, ox_target, and what usually breaks.
How to add a job on ESX Legacy: jobs and job_grades SQL, setjobAdd a custom job to ESX Legacy with two SQL inserts into jobs and job_grades, set it with /setjob, read it in scripts with xPlayer.job, and link it to a society account.
FiveM money types: cash, bank and black money on ESX, QBCore and QBoxHow money works on FiveM: ESX accounts (money, bank, black_money), QBCore cash, bank and crypto, ox_inventory cash as an item, and the reason strings for your logs.
How to install ESX Legacy on a FiveM server: recipe and manualInstall ESX Legacy with a txAdmin recipe or by hand: es_extended, core resources, oxmysql, SQL import, server.cfg order, first login checks and the first errors.
How to install a QBCore server: txAdmin recipe and manual stepsInstall QBCore on FiveM with the txAdmin recipe or by hand: qb-core, the qb resources, oxmysql, SQL import, server.cfg, first checks and the most common first errors.How to install a QBox server: recipe, stack and first errors · Migrate ESX to QBox: what transfers, what breaks and a checklist · How to add a job on QBCore: shared/jobs.lua, grades and /setjob · Server callback returns nil: ESX, QBCore and ox_lib callbacks
Inventory & items
ESX items: the items table, RegisterUsableItem and addInventoryItemAdd an item to ESX: the items SQL table, ESX.RegisterUsableItem to make it usable, addInventoryItem, removeInventoryItem, getInventoryItem and canCarryItem, plus the ox_inventory note.
FiveM crafting system: ox_inventory benches and custom craftingBuild crafting on FiveM: ox_inventory crafting benches in data/crafting.lua with ingredients and zones, a custom server-checked recipe, and anti-dupe tips.
How to add items to ox_inventory: items.lua, images and usable itemsAdd a custom item to ox_inventory: the data/items.lua entry, the image in web/images, giving it with AddItem, and making it usable with a client export.
ox_inventory item metadata: AddItem, Search, SetMetadata and unique itemsUse metadata in ox_inventory: add items with data, search and read slots, update with SetMetadata, show a custom label and description, and make unique items like IDs and keys.
ox_inventory shops: data/shops.lua, RegisterShop and blipsHow to create a shop in ox_inventory: the data/shops.lua entry, prices and currency, locations and targets, job-locked shops, RegisterShop from another resource, and blips.
ox_inventory stashes: RegisterStash, openInventory and job stashesHow to create stashes in ox_inventory: register one on the server, open it from the client or ox_target, make it personal per player, or lock it to a job.ox_inventory weapons and ammo: data/weapons.lua and weapons vanishing · How to add items on QBCore: items.lua, images, CreateUseableItem · QBCore usable items: CreateUseableItem, AddItem and RemoveItem
Vehicles
How to add addon cars to a FiveM server: stream and data filesAdd addon cars to FiveM step by step: the stream folder, vehicles.meta, carvariations.meta, carcols.meta, handling.meta, fxmanifest data_file lines, addon vs replace.
Add cars to the FiveM vehicle shop (ESX vehicles table, QBCore, QBox)How to add a car to a dealership: the ESX vehicles and vehicle_categories tables, QBCore and QBox shared vehicles.lua entries, and why a car shows up with no price.
Edit handling.meta in FiveM: speed, grip, brakes and HANDLING_FILEEdit a car handling.meta on FiveM: key fields (fInitialDriveForce, fBrakeForce, fTractionCurveMax, fMass), HANDLING_FILE, matching handlingName, testing and runtime.
FiveM garage: owned_vehicles and player_vehicles, missing cars fixedVehicles missing from the garage? How the ESX owned_vehicles and QBCore player_vehicles tables work, the stored and state columns, and the SQL to fix cars stuck out.
FiveM vehicle fuel: set fuel on spawn and fix cars stuck at 0How fuel works in FiveM: GetVehicleFuelLevel and SetVehicleFuelLevel, fuel in state bags, setting fuel when you spawn a car, and why vehicles start with an empty tank.
FiveM vehicle keys: can't drive your own car or lock it? Fix itHow FiveM vehicle key systems work: plate lists, giving keys after a spawn or purchase, locking with SetVehicleDoorsLocked, and why you lose access to your own car.Spawn a vehicle in FiveM: CreateVehicle vs CreateVehicleServerSetter · FiveM vehicle damage: engine health, body health and handling tweaks · Get and set vehicle properties in FiveM: lib, ESX and QBCore · FiveM vehicles disappearing or despawning: why it happens and the fix
Jobs & gameplay
FiveM drug system design: gathering, processing and selling safelyHow to design a FiveM drug system: gathering and processing with server-side item checks, rate limits, selling to NPCs safely, police alerts and balancing payouts.
FiveM death and revive system: last stand, respawn and state bagsHow a FiveM death system works: last stand vs dead, respawn timer, reviving from admin or EMS, syncing the dead state with state bags, and fixing combat logging.
FiveM housing and apartments: shells, instances, stashes and keysHow a FiveM housing system works: shell and MLO interiors, instancing with routing buckets, a stash per house, keys and permissions, and saving ownership in the database.
FiveM mechanic job: repair natives, tuning mods and job checksBuild a FiveM mechanic job: repair a vehicle with SetVehicleFixed and health natives, tune with SetVehicleModKit and SetVehicleMod, save mods, and gate actions by job.
FiveM police job setup: grades, duty, armory and police countHow to set up a police job on a FiveM server: job and grades, duty toggle, armory with shop and stash, cuffing and escorting, police count checks, MDT and dispatch.
FiveM store and bank robbery scripts: setup and server-side designHow to set up and design store and bank robberies on FiveM: police count, server-side cooldowns, rewards given only by the server, police alerts and distance checks.FiveM server economy balance: paychecks, money sinks and inflation
Menus, targets & UI
How to create map blips in FiveM: AddBlipForCoord and radius blipsCreate blips in FiveM with AddBlipForCoord: sprite, colour, scale, short range, a name label, radius blips with AddBlipForRadius, removing blips and job-only blips.
DrawMarker, help text and lib.showTextUI without lag in FiveMDraw markers and show 'Press E' prompts in FiveM without a heavy loop: DrawMarker only when near, help text natives, lib.showTextUI and ox_lib points for zones.
FiveM animations and props: TaskPlayAnim flags, attach to bone, deletePlay animations and attach props in FiveM Lua: RequestAnimDict, TaskPlayAnim flags 1, 16, 32 and 49, ClearPedTasks, AttachEntityToEntity to a bone, scenarios and cleanup.
FiveM NUI with React and Vite: setup, callbacks and browser devBuild a FiveM NUI with React and Vite: ui_page and files in fxmanifest, base './', SendNUIMessage, RegisterNUICallback, SetNuiFocus and developing in the browser.
FiveM notifications and progress bars: ESX, QBCore and ox_libSend notifications and show progress bars on ESX, QBCore and ox_lib with ShowNotification, Functions.Notify, lib.notify and lib.progressBar, plus one bridge function.
Debug FiveM NUI: nui_devtools, console errors and failed callbacksDebug a FiveM NUI: open Chromium devtools with nui_devtools, read Uncaught TypeError errors, fix a failed fetch to https://resource/cb and test the UI in a browser.FiveM cursor stuck or can't move after closing a menu: NUI focus fix · ox_lib context menu: registerContext, inputDialog and alertDialog · ox_lib zones: lib.zones.box, sphere and poly with onEnter and onExit · ox_target addBoxZone, addModel and addLocalEntity: how to add targets · Play custom sounds in FiveM: NUI audio, volume by distance, formats · qb-target vs ox_target: convert AddBoxZone and fix targets not showing · RegisterCommand and RegisterKeyMapping: rebindable keys in FiveM
Scripting
escrow_ignore in fxmanifest: keep config.lua and locales openFor script sellers: how escrow_ignore keeps config.lua and locale files readable, what stays open, how to upload to the Cfx.re portal and test the escrowed build.
FiveM events: RegisterNetEvent, TriggerServerEvent, TriggerClientEventHow FiveM client and server events work: RegisterNetEvent, AddEventHandler, TriggerServerEvent, TriggerClientEvent with -1, the source variable and event naming.
FiveM exports in Lua: exports('name', fn) and 'No such export'How to define and call exports in FiveM Lua, the fxmanifest exports and server_exports styles, and how to fix 'No such export' errors caused by start order or the wrong side.
FiveM KVP storage: SetResourceKvp and GetResourceKvpString guideSave client settings without a database using FiveM KVP: SetResourceKvp, GetResourceKvpString, SetResourceKvpInt, DeleteResourceKvp, json.encode for tables, and its limits.
FiveM routing buckets: SetPlayerRoutingBucket, instances and voiceHow FiveM routing buckets work: SetPlayerRoutingBucket, SetEntityRoutingBucket, population and lockdown settings, bucket 0, use cases and what happens to voice.
FiveM script locales: translatable scripts with en.lua, ox_lib and ESXMake your FiveM script translatable: a locales folder with en.lua and es.lua, a simple locale function, ox_lib's locale system, ESX TranslateCap and a language config.FiveM state bags: Entity(entity).state, GlobalState and handlers · FiveM CreateThread and Wait(0) explained: why your script costs ms · FiveM TypeScript resources: fxmanifest, @citizenfx types and esbuild · FiveM VS Code setup: Lua language server, natives, no false warnings · __resource.lua to fxmanifest.lua: how to convert an old script · oxmysql queries guide: MySQL.query.await, single, scalar, insert · How to sell FiveM scripts: Tebex, Cfx.re escrow, packaging and support
Maps & streaming
How to add addon peds to FiveM: stream files, peds.meta, spawn nameAdd addon peds to a FiveM server: the stream files (ydd, yft, ytd, ymt), peds.meta with PED_METADATA_FILE, spawning by model name and setting a ped as the player model.
Add EUP and addon clothing packs to FiveM: stream, meta, fixesInstall addon clothing packs (EUP style) on FiveM: stream files, ymt and meta, addon vs replace, game build, and why clothes are invisible or swap other items.
Custom loading screen for FiveM: loadscreen, fxmanifest and shutdownMake a custom FiveM loading screen: fxmanifest loadscreen and files, loadscreen_manual_shutdown with ShutdownLoadingScreenNui, music and video size tips, one loadscreen only.
Disable or reduce NPC traffic and peds in FiveM: density nativesTurn off or reduce NPCs, traffic and parked cars in FiveM with the density multiplier natives, the per-frame rule, routing buckets, removing cops and the cost of each option.
Falling through the map in FiveM: collisions not loading, how to fixPlayers fall through the map on spawn or teleport? Fix late collisions: missing .ybn files, too much streaming, RequestCollisionAtCoord and HasCollisionLoadedAroundEntity.
How to install an MLO on a FiveM server: stream, fxmanifest, ensureInstall an MLO or map on FiveM: the stream folder, fxmanifest.lua with this_is_a_map, the ytyp data_file line, ensure, game build and how to test it in game.MLO map conflicts in FiveM: missing walls, flickering, duplicate props · Oversized assets can and WILL lead to streaming issues: the fix
Game & client
How to clear the FiveM cache: which folders to delete (and which not)Texture glitches, old streamed files, or crashes after an update? How to clear the FiveM client cache: the data folder, cache, server-cache, server-cache-priv, and what to keep.
ERR_GFX_D3D_INIT in FiveM and GTA V: how to fix the DirectX crashERR_GFX_D3D_INIT closes FiveM at launch? Update GPU drivers, change the DirectX version, undo overclocks, reset settings.xml and test windowed mode, step by step.
FiveM Connection timed out / Failed to getinfo server: how to fix itServer->client connection timed out or Failed to getinfo server after 3 attempts? Check the server, port, firewall, VPN, DNS and hitches. Fixes for players and owners.
FiveM crashes on startup: fixes and how to share the crash reportFiveM crashes when you launch it or connect? Clear the cache, verify GTA V, disable overlays, add antivirus exclusions, update drivers, and share the crash dump.
Verify GTA V game files for FiveM: Steam, Epic and Rockstar launcherFiveM refuses to start or crashes on modified game files? Verify GTA V on Steam, Epic Games and the Rockstar launcher, and keep your GTA folder free of old mods.
FiveM low FPS fix: settings, texture budget and server-side causesLow FPS on FiveM servers but fine in single player? Fix it with graphics settings, the Extended Texture Budget, GPU settings, background apps, and server-side causes.FiveM won't open or gets stuck on launch: how to fix it on Windows · FiveM server requires Steam: fix the missing Steam identifier · FiveM stuck on the loading screen: causes and how to debug it
Security & admin
How to make yourself admin on FiveM: add_ace, add_principal, group.adminNot an admin on your own FiveM server? Add yourself with add_ace and add_principal, find your license, fivem or discord identifier, and set the ESX or QBCore admin group.
Discord webhook logs from a FiveM server: PerformHttpRequest guideSend logs to Discord from FiveM with PerformHttpRequest and JSON embeds. Server side only, URL in a convar, a queue for rate limits, and what to log.
Discord whitelist for FiveM: allow players by Discord roleBuild a Discord role whitelist for your FiveM server: playerConnecting with deferrals, the Discord identifier, a bot role check through the REST API, and a safe token.
FiveM anticheat basics: what to do and what no anticheat can doAnticheat basics for FiveM: validate on the server first, OneSync entity limits, cancelling explosions, Discord webhook logs, txAdmin bans and what no anticheat can do.
FiveM playerConnecting and deferrals: defer, update, done explainedHow AddEventHandler('playerConnecting') works with deferrals: defer, Wait(0), update, done(reason), adaptive cards, and why players hang when you forget to call done.
Secure FiveM server events: stop cheaters from abusing net eventsCheaters trigger your server events with any values. How to validate on the server: use source, check distance, job and cooldowns, and keep prices in a server table.txAdmin: how to warn, kick and ban players (and revoke a ban)