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 10 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 10 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 — 10y
Ad

Answer this question