Attempt to index a nil value items (help!)

364 Views Asked by At

So I am getting the error

[script:tb_fuel] SCRIPT ERROR: @tb_fuel/config.lua:117: attempt to index a nil value (global 'ESX') [script:tb_fuel] > getplayer (@tb_fuel/config.lua:117)`,

I have no idea what is causing this and how to fix it.

Code from line 117:

function getplayer(source)
    xPlayer = ESX.GetPlayerFromId
    return xPlayer
end
1

There are 1 best solutions below

0
Célyan Mellinger On

you have to define ESX with ESX = nil, you also have to use ESX framework, and you forgot (source) after GetPlayerFromId, your code should be like this :

function getplayer(source)
    xPlayer = ESX.GetPlayerFromId(source)
    return xPlayer
end