Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

1 answer

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)

3 comments

0

Also, use a print function to print out the amount of players

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.

0

OK, thanks for that, I'll use that for future reference.

This discussion is preserved as it was. New answers, comments, and votes are closed.