How can I do something in increments of 2 when a timer is going down in increments of 1?

Hello Devforum! I am currently working on a small minigame project, but I have run into a tiny problem that my small brain just can’t comprehend. I have a forloop that counts down a round, but I have a function in the forloop that will trigger something in the minigame every second. The thing is, I want to have it so that this function only triggers every other second to slow things down. Is there anyway I can go about doing this? I tried using coroutines, but that didn’t work, and I can’t think of anyway to do this.

The section of code with the issue:

		if chosengame.Name == "Checkerboard of Death" then
			local roundtime = 60
			for i = roundtime, 0, -1 do
				text.Value = "Time Left: "..i
				checkerboard()
			end
		end

You can make it run on every even number by checking if “i” is a mod of 2.

for i = roundtime, 0, -1 do
	-- runs every second
	if i % 2 == 0 then
		-- runs every even number
	else
		-- runs every odd number
	end
end
1 Like
if chosengame.Name == "Checkerboard of Death" then
	local roundtime = 120
	for i = roundtime, 0, -2 do
		text.Value = "Time Left: "..i/2
		checkerboard()
	end
end

Stayed true to your original code, just increase the timer and decrement value by a factor of 2 and decrease the time displayed by a divisor of 2. This also circumvents the necessity of an additional conditional check per cycle of the loop.