QBCore is nil: 'attempt to index a nil value (global QBCore)' – Fix
The error
attempt to index a nil value (global 'QBCore')
What it means
The script uses QBCore without defining it. Older scripts used the removed QBCore:GetObject event, or the file runs before qb-core has started.
The fix
-- top of every client/server file that uses QBCore
local QBCore = exports['qb-core']:GetCoreObject()In server.cfg, make sure ensure qb-core comes before your resource (or add dependency 'qb-core' to your fxmanifest). Replace any TriggerEvent('QBCore:GetObject', ...) lines.
Related tools: QBCore script generator · Fix a FiveM Lua error · all script generators