ESX.RegisterServerCallback > attempt to index a nil value (global 'ESX')

Notes: ESX = nil is at the top of the file. Using ESX Legacy 1.9.0
I’m getting errors on a newly bought FiveM business script and the errors are pointing to

attempt to index a nil value (global ‘ESX’)
stack traceback

ESX.RegisterServerCallback(‘esx_fivem_shop:getInventory’, function(source, cb)
local xPlayer = ESX.GetPlayerFromId(source)
local items = xPlayer.inventory

cb({items = items})

end)

And everything else ESX.RegisterServerCallback related in the exact same file.

did you find out the solution? i am having the same issue with all my script which was working before with previous version 1.4

No solutions yet.

For ESX 1.9.0 replace ESX = nil with ESX = exports[‘es_extended’]:getSharedObject() in each script, also remove the getSharedObject TriggerEvent

it has worked for me in most cases

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.