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

How can I add the player names from game.Players into a table?

plrs = {}

function GetPlayerNames()
For i, v in pairs(game.Players:GetChildren()) do
if v.Character then
table.insert(plrs, v.Name)
end
end
end

Will this work?(I haven't tested)

1 answer

The For has the be lowercase, and it would be better to use :GetPlayers() rather than :GetChildren()

Note: :GetPlayers() only works on the Players Service

1 comment

0

Okay, thanks!

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