Why does this not work?

for k,v in pairs(cPlayers) do
local playerName = GetPlayerName(GetPlayerFromServerId(v))

it says invalid.
If i print the value, its there. If i write the value in directly, like “2” it works properly. but if it reads 2 from table it doesnt work.
Any idea? Its like a value type problem.

The table you are using to store the player’s server ID’s, are the ID’s stored as a string or number? Maybe try this? :

local playerName = GetPlayerName(GetPlayerFromServerId(tonumber(v)))

worked, thanks. I figured that out the time i posted this, :smiley: