How do I make it so something like 3.00 goes down to 2.59 and not 2.99?

I want to make it so when the countdown changes a minute, it goes to something like 2.59, but right now, it goes down to 2.99, anyone know how to use the code I have right now to make it go like that?
I’ve tried changing the second value so when its subtracted by 3.00, it changes value so when subtracted it goes to 59, but that didn’t work

local status = "Intermission"

local function timer()
	local start = tick()
	local where = "3.00"
	local previous = 0
	local present = 0
	while where ~= "0.00" do
		present = math.floor(tick() - start)
		if present > previous then
			previous = present
			local minutes = math.floor(present/60)
			local seconds = previous%60
			local hi = tonumber(string.format("%d.%02d",minutes,seconds))
			where = tostring(3.00 - hi)
			local seperate = string.split(where,".")
			game.ReplicatedStorage.Seconds.Value = tonumber(seperate[2])
			game.ReplicatedStorage.Minutes.Value = tonumber(seperate[1])
		end
		wait()
	end
end

timer()
1 Like

I used the Search bar up top and typed in “minutes & seconds timer” and got a few hits there.

1 Like

I make a minute:second timer this way, so maybe this could help you

local function timerConverter(i)
	local seconds = i % 60
	local minutes = (i - seconds)/60
	local roundTime 
	if seconds < 10 then
		roundTime = minutes..':0'..seconds
	else
		roundTime = minutes..':'..seconds
	end
	return tostring(roundTime)
end

what do I put in the paramater when I call the function?

You would put the seconds, and the function would convert it into minutes:seconds

ah ok thank you, ill test it out right now

sadly it doesn’t work, it goes down from 3.00, to 2.99, not 2.59

local intermissionTime = 300

while intermissionTime > 0 do
	local seconds = intermissionTime % 60
	local minutes = math.floor(intermissionTime / 60)
	
	if seconds < 10 then
		seconds = "0"..seconds
	end
	
	print(minutes..":"..seconds)
	intermissionTime -= 1
	wait(1)
end
local status = "Intermission"
local debounce = false
local numbers = {1,2,3,4,5}
local function timer()
	local start = tick()
	local where = "3.00"
	local previous = 0
	local present = 0
	while where ~= "0.00" do
		present = math.floor(tick() - start)
		if present > previous then
			previous = present
			local minutes = math.floor(present/60)
			local seconds = previous%60
			if seconds >= 0 and seconds <= 61 then
				seconds += 40
				local hi = tonumber(string.format("%d.%02d",minutes,seconds))
				where = tostring(3.00 - tonumber(minutes.."."..seconds))
				local seperate = string.split(where,".")
				for _, v in pairs(numbers) do
					if seperate[2] == tostring(v) then
						seperate[2] = seperate[2].."0"
					end
				end
				if tonumber(seperate[2]) == 6 then
					if seperate[2] ~= "06" then
						seperate[2] = "00"
					end
				end
				game.ReplicatedStorage.Seconds.Value = seperate[2]
				game.ReplicatedStorage.Minutes.Value = seperate[1]
			end
		end
		wait()
	end
end
``` I found the solution