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

Is there a way to detect how many players are in a server?

Asked by 4 years ago

I'm trying to make a game that gives you a badge every time a curtain amount of players are in the server. If you could please send me a script that detects that, I'll be able to take it from there. Thanks.

2 answers

Log in to vote
1
Answered by
emervise 123
4 years ago
local badgeservice = game:GetService("BadgeService")
local badge = (numbers)
local player = game.Players.LocalPlayer

while true do
    if game.Players:GetChildren == 50 then
        badgeservice:AwardBadge(player.UserID, badge)
    end
end

This is assuming you have already made the badge and stuff lol. Also this is a local script in starter player scripts.

0
Thanks. stickymirro511 61 — 4y
Ad
Log in to vote
2
Answered by 4 years ago
local players = game.Players:GetChildren()
local numOfPlayers = #players

Answer this question