Making a countdown with 2 decimals

Hey! Just as the title says. I’ve already looked at other posts but I couldn’t get my answer. What I currently have only shows 1 decimal. If I change wait(0.1) to wait() and change -1 to -0.1 then the script can’t keep up, thus making a 1 second countdown to a 3 second countdown in reality. So a for loop is out of the question.

local start = 1
local finish = 0
for i = start * 10, finish * 10, -1 do
	wait(0.1)
	script.Parent.Text = i/10 .."s"
end
local Timer = 10 
local Sec = 0
local StartTime = tick()

while Sec < Timer do 
	Sec = tick()-StartTime
	
	script.Parent.Text = string.format("%02i:%02i", Sec, (Sec*100)%100)
	task.wait()
end

Couldn’t you try doing like multiple for I loops so

for s = start * 10, finish * 10, -1 do
	for m = 0,100 do
         task.wait(0.01)
         script.Parent.Text = i.."."..m .."s"          


    end
end

Or something like that

This is exactly what I want, just the opposite. I want the number to go from 10-0 not from 0-10. And I don’t really understand how it works so I can’t change it myself.

local Left = 10
local StartTime = tick()

while Left > 0 do 
	Left = (10-tick()+StartTime)

	script.Parent.Text = string.format("%02i:%02i", Left, (Left*100)%100)
	task.wait()
end
script.Parent.Text = "00:00" --// so when the timer ends the text will always be 00:00 
1 Like

Thank you for your help! I really appreciate it!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.