ESX Duty Attempt to index a nil value (local 'xPlayer')

Getting this error for esx duty script maybe someone smart can help me out xc
im not a expert at deving im still learning everyday but if anyone can help me out that would make life easier xd

ESX = nil

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

AddEventHandler("playerDropped", function()
	local _source = source
    local xPlayer = ESX.GetPlayerFromId(_source)
    local job =         <---------------------this line 
    local grade = xPlayer.job.grade
    if job == 'police' or job == 'ambulance' then
        xPlayer.setJob('off' ..job, grade)
        TriggerEvent("■■■■■■■■:removePlayerFromAllRadio", _source)
        TriggerEvent("eblips:remove", _source)

still need help with these 2 errors :frowning: