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
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
Use game.Players:GetPlayers() to get the players. Then print the #players
local players = game.Players:GetPlayers()
print(#players)
Players = game.Players:GetChildren() print(#Players)
This discussion is preserved as it was. New answers, comments, and votes are closed.
7 comments
How do I find how many there are though?
That will get the number of players.
I've written: players = game.Players:getplayers() print(players)
I get 'nil'
local players = game.Players:GetPlayers() print(#players)
Works. Thanks for your help! :-)
You're welcome. :)