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

How do I get the current number of players in a server?

Asked by
314cake 17
6 years ago

I saw that there was a NumPlayers property, but it seems to be deprecated.

0
I never liked how it became deprecated considering it's faster than #game.Players:GetPlayers() , but you can use that if you prefer it Vulkarin 581 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago
local numPlayers = #game.Players:GetChildren() -- Or GetPlayers() whatever your preference is
0
Thank you! 314cake 17 — 6y
0
what does the # do? maup12345 20 — 6y
0
It's like a count, it gets the number of elements in a table. climethestair 1663 — 6y
0
Works, but game.Players.NumPlayer would do the same AvionicScript 65 — 6y
0
It's deprecated, don't NumPlayer. climethestair 1663 — 6y
Ad

Answer this question