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
7 years ago

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

1 answer

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

Here's the script

01local players = 0
02local vip = false
03 
04game.Players.PlayerAdded:connect(function(player)
05    if game.VIPServerId ~= 0 then
06        vip = true
07        for i,v in pairs(game.Players:GetChildren()) do        
08            players = players + 1
09            end
10        end
11end)
12 
13game.Players.PlayerRemoving:connect(function(player)
14    if game.VIPServerId ~= nil and vip == true then
15        for i,v in pairs(game.Players:GetChildren()) do
16            players = players - 1
17 
18        end
19        end
20end)
0
Also, use a print function to print out the amount of players StarMarine614Classic 14 — 7y
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 — 7y
0
OK, thanks for that, I'll use that for future reference. StarMarine614Classic 14 — 7y
Ad

Answer this question