Need help scripting a Rocket Countdown Timer

I want to achieve a timer that counts down and once it has reached it’s final goal it counts back up again.

My issue is that I cant think of a way that I could make the Countdown count back up once its reached 00:00

I’ve tried solutions such as: Using if statements to detect when it has reached its final goal and then start counting up, I have also tried adding boolean values as well.

local Time =  script.Parent.Time
local MaxTime = 5

while wait(1) do
	local Minutes = math.floor(MaxTime / 60)
	local Seconds = MaxTime - Minutes * 60
	Seconds = math.floor(Seconds)
	if string.len(Seconds) < 2 then Seconds = "0" .. Seconds end 
	if string.len(Minutes) < 2 then Minutes = "0" .. Minutes end
	local Format =  Minutes .. ":" .. Seconds
	MaxTime -= 1
	Time.Text = "T-"..Format
end

This is my script so far, I used a DevForum post to help me with this Part and then further modified it to work with my needs.

This is it so far:
https://gyazo.com/411c1a6457717c70cddce38729bbe8b2

1 Like

Hey there, luckily I’ve done the same thing, here’s how I did it.



local var = 60
local above = 0 

function time1()
	var = var - 1
	script.Parent.Text = "Rocket Liftoff in: T - "..var
	wait(1)
	script.Parent.Value.Value = var
end

repeat
	time1()
until var == 0


while wait(1) do 
	if var == 0 then
		above = above + 1
		script.Parent.Text = "T + "..above
	end
end

Just have your UI set up so that you have a textlabel, then in the text label is a localscript. Have a StringValue in that TextLabel too, this should work. The variable “var” is how long you want your timer to be.

1 Like

Thank you, this will help greatly. :slight_smile:

1 Like