Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Assigning a Number to players Help?

I just need an idea of how could I can assign a number to a player, I'm thinking a for with tables

Players = game.Players:GetChildren()
Table{}
for i = 1 ,  Players
-- Assign a number like the first play = 1 then the second player = 2--
table.Insert(Table, "Each Number of the players")

I'm not sure exactly maybe for i,v in pairs()?

3 comments

0

userid?

0

Why do you want to do this? Explain what you want to accomplish.

1 answer

✓ Accepted answer

If you are trying to go and assign the number that they are in players the easiest way to do this would be to use code similar to this:

playerNums = {};
for i,v in pairs(game.Players:GetChildren()) do
  table.insert(playerNums, i, v.Name); -- This code will add the player's name into the table at the position of their index in the array of children.
end;

If this didn't help then please feel free to ask any questions you may have and I will be glad to try and answer them.

This discussion is preserved as it was. New answers, comments, and votes are closed.