U need to change
Lane 441 and 442 to this code
local playerX, playerY, playerZ = table.unpack(GetEntityCoords(GetPlayerPed(player), true))`
local distance = GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(player)),GetEntityCoords(entity), true)