Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 9 years ago
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

Log in to vote
1
Answered by 9 years ago

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

0
Okay, thanks! ferseus 0 — 9y
Ad

Answer this question