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

Countdown not working?

Hi guys! All I am trying to do, is display a countdown for all players at the same time and then display a message to the blue team, and a message to the green team - however I cannot get it to work :/ Any ideas? Thanks

function countdown()
  for n = 3, 0, -1 do
    for i, v in pairs(game.Players:GetPlayers()) do
      if n == 0 then --changed it!
        v.PlayerGui.Countdown.TextLabel.Visible = true
        v.PlayerGui.Countdown.TextLabel.Text = n
        if v.TeamColor == BrickColor.new("Bright green") then
          v.PlayerGui.Countdown.TextLabel.Text = "Escape!"
        elseif v.TeamColor == BrickColor.new("Bright blue") then
          v.PlayerGui.Countdown.TextLabel.Text = "Shoot the escapers!"
        else
          print ("They don't get a countdown 'cause they are not playing the game")
        end
      else
        v.PlayerGui.Countdown.TextLabel.Visible = false
        v.PlayerGui.Countdown.TextLabel.Text = ""
      end
    end
    wait(1)
  end
end

1 answer

Your making it display 0... Its displaying the countdown once its finished because of the

if n == 0 then

Try this code

function countdown()
  for n = 3, 0, -1 do
    for i, v in pairs(game.Players:GetPlayers()) do     
        v.PlayerGui.Countdown.TextLabel.Visible = true
        v.PlayerGui.Countdown.TextLabel.Text = n
		if n == 0 then --changed it!
        	if v.TeamColor == BrickColor.new("Bright green") then
          	v.PlayerGui.Countdown.TextLabel.Text = "Escape!"
        	elseif v.TeamColor == BrickColor.new("Bright blue") then
         	 	v.PlayerGui.Countdown.TextLabel.Text = "Shoot the escapers!"
        	else
          		print ("They don't get a countdown 'cause they are not playing the game")
        	end
      	else
       		 v.PlayerGui.Countdown.TextLabel.Visible = false
       		 v.PlayerGui.Countdown.TextLabel.Text = ""
      end
    end
    wait(1)
  end
end

1 comment

0

Thanks - this displays the message but not the countdown :/ Any ideas?

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