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

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

Asked by 2 years ago

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

Log in to vote
0
Answered by 2 years ago

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.

Ad

Answer this question