I must know how to detect how many players there are, is there something like
game.Players:GetPlayersAmount()
? please help, thanks :)
There is a function of Players
which is :GetPlayers()
. It returns an array of all the players in the game. This can be used in conjunction with the unary length operator #
. The length operator can be used to get the length of a table or string. The length of the table is however many elements there are in it.
lua
print(#game:GetService("Players"):GetPlayers());
I believe there are 2 ways to go about this There is a built-in function
#game.Players:GetPlayers()
and
#game.Players:GetChildren()
I'd recommend using the built-in function which I believe is just an alternative of "GetChildren"