ScriptsAboutBlogToolsKnowledge BaseReviewsFAQBasketDocsSupport
Frameworkcrash

attempt to index a nil value (global 'QBCore')

Also seen as: QBCore nil global QBCore not defined GetCoreObject nil

What causes it

The QBCore object is nil — you used it before assigning it, or qb-core isn't started before your resource. The correct pattern is exports['qb-core']:GetCoreObject().

How to fix it

Assign QBCore via the export and ensure qb-core starts first.

  1. At the top of your files: local QBCore = exports['qb-core']:GetCoreObject().
  2. In server.cfg, ensure qb-core before dependent resources.
  3. Check qb-core itself started without errors.
  4. Watch for a typo in the export name.

Related errors

Related guides

Still stuck? We can help.

Optimized, dual-framework scripts for QBCore and ESX from Viper Development — escrow protected, delivered instantly to your Cfx portal.