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

How to check the amount of players in a reserved servers?

Asked by
iRexBot 147
6 years ago

The title is my question pretty much. How can you?

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Here's the script

local players = 0
local vip = false

game.Players.PlayerAdded:connect(function(player)
    if game.VIPServerId ~= 0 then
        vip = true
        for i,v in pairs(game.Players:GetChildren()) do         
            players = players + 1 
            end
        end
end)

game.Players.PlayerRemoving:connect(function(player)
    if game.VIPServerId ~= nil and vip == true then
        for i,v in pairs(game.Players:GetChildren()) do
            players = players - 1

        end
        end
end)
0
Also, use a print function to print out the amount of players StarMarine614Classic 14 — 6y
0
This site isn't really for providing code for people but if you are then try to at least explain what you are doing. xPolarium 1388 — 6y
0
OK, thanks for that, I'll use that for future reference. StarMarine614Classic 14 — 6y
Ad

Answer this question