Nametag with Job Label

Hi Guys,
I’m currently trying to write a nametag system for the Aduty. Everything works perfectly.

Now I just tried to display the Job.Label from the player on the nametag. However, it shows the Job.Label from the admin that has the nametag. Can someone tell me what I’m doing wrong?

Citizen.CreateThread(function()
    while true do
        if Player.showName then
            for k, v in ipairs(ESX.Game.GetPlayers()) do
                local otherPed = GetPlayerPed(v)
                local playerdatara = ESX.GetPlayerData(v)

                if otherPed ~= plyPed then
                    if #(GetEntityCoords(plyPed, false) - GetEntityCoords(otherPed, false)) < 1000.0 then
                        Player.gamerTags[v] = CreateFakeMpGamerTag(otherPed,("%s [%s] [%s]"):format(playerdatara.job.label ,GetPlayerServerId(v), GetPlayerName(v)), false, false, "", 0)
                    else
                        RemoveMpGamerTag(Player.gamerTags[v])
                        Player.gamerTags[v] = nil
                    end
                end
            end
        end

        Citizen.Wait(100)
    end
end)

This is the Code

Hello,
ESX.GetPlayerData() can only return YOUR data, not that of somebody else. You’ll have to figure out another way of getting other player’s jobs.

Hey, thanks for the quick reply. What other possibility would I have to inquire about the job?

and? is that posible that the scirpt / system shows the Job from every player?

Hello there,

Absolutely, that should work. You’d just need to use a callback (Client → Server → Client) to get a list of the information you need.

Then, server-side, you could generate a table for each player containing details such as job name, rank, ID, and player name. After that, you can proceed with utilizing the Thread provided by dreamer5655.

And how i dont it i know it very much to aks for but i have no idea