Need some help with esx

I make a little esx script, but it seems i can’t get it working (tried researching it).
It doesn’t give any error in the cmd, only in the in game console (f8)
This is the error: SCRIPT ERROR: @esx_test/test.lua:6: attempt to call a nil value (field ‘GetPlayerFromId’)

my code and fxmanifest are down below.

my script:
ESX = nil

TriggerEvent(‘esx:getSharedObject’, function(obj) ESX = obj end)

RegisterCommand(“coords”, function(source)

local xPlayer = ESX.GetPlayerFromId(GetPlayerPed(-1))

local coords = xPlayer.getCoords(true)

TriggerEvent('chat:addMessage', {

    color = { 255, 0, 0},

    multiline = true,

    args = {"Me", coords}

  })

end)

my fxmanifest file:

fx_version ‘adamant’

game ‘gta5’

description ‘ESX Test’

version ‘1.0.0’

client_scripts {

'@es_extended/locale.lua',

'test.lua'

}

dependency ‘es_extended’

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