Is it possible to see how many players are in a place/universe place with a script?
✓ ANSWER ACCEPTED
See how many players are in a place?
1 answer
✓ Accepted answer
You could find that out with two efficient ways:
local plrs_in_game = game.Players.NumPlayers
or
local plrs_in_game = #game.Players:GetPlayers()
Both of them will return the number of players in the server.
If you want to find out how many in a place, you would have to use datastores
game.Player.PlayerAdded:connect(function()
game:GetService("DataStoreService"):GetDataStore("Plrs"):IncrementAsync("Players",1)
end)
game.Player.PlayerRemoving:connect(function()
game:GetService("DataStoreService"):GetDataStore("Plrs"):IncrementAsync("Players",-1)
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
