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

How do I list every player into a table?

I know how to do insert table but I dont know how to get a list of the players can someone help?

Heres my script so far:

local players = {}

2 answers

✓ Accepted answer

Use a for loop

local players = {}
for i,v in pairs(game.Players:GetChildren()) do --where i is the index and v is the value
	table.insert(players,v.Name) --v is each player in the game so .name is their name
end

1 comment

0

thank you so much i didnt even know you could do that. :D

game.Players:GetPlayers() returns a list of all of the players currently in the game.

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