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

How can I count how many players there are?

How can I count how many players are in the Players section of my game?

I have got all the children by doing game.Workspace.Players:getChildren

How do I count how many players there are?

Thanks! traigla

2 answers

✓ Accepted answer

Use game.Players:GetPlayers() to get the players. Then print the #players

local players = game.Players:GetPlayers()
print(#players)

7 comments

0

How do I find how many there are though?

0

That will get the number of players.

0

I've written: players = game.Players:getplayers() print(players)

0

I get 'nil'

0

local players = game.Players:GetPlayers() print(#players)

0

Works. Thanks for your help! :-)

0

You're welcome. :)

Players = game.Players:GetChildren() print(#Players)

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