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

How can I make this only work for 2 players instead of 1?

So I want this script to work ONLY more than 2 players - but if there are less than 2, nothing will happen so the server will check players every 5 seconds.

local function startRound()
	coroutine.wrap(function()
		for i = 10, 1, -1  do 
			blueTimer.Text = i
			if i == 1 then
				sign1.Color = Color3.new(0, 1, 0)
				blueTimer.Text = "ahe!!"
				Wall.Position = Vector3.new(-27, -41.952, -115.25)
				game.SoundService.StartRound:Play()
			end
			task.wait(1)
		end
	end)()

	coroutine.wrap(function()
		for i = 10, 1, -1 do 
			redTimer.Text = i
			if i == 1 then
				game.SoundService.StartRound:Play()
				sign2.Color = Color3.new(0, 1, 0)
				redTimer.Text = "wa"
			end
			task.wait(1)
		end
	end)()
end

1 answer

You can use #game.Players:GetPlayers() to get the amount of players in a server.

I would suggest that you check the amount of players that are in the server and everything before you fire the startRound() function.

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