Countdown (too complex) is not working

Hi!

My script here is probably way too complex. It only works once. What’s wrong?

local update = false
if update == false then
	local timeForUpdate = 00

	timeForUpdate = 60
	for i = 1,60 do
		wait (1)
		timeForUpdate -= 1
		script.Parent.Text = timeForUpdate
	end
	if timeForUpdate == -1 then
		update = true
	else 
		timeForUpdate = 60
		for i = 1,60 do
			wait (1)
			timeForUpdate -= 1
			script.Parent.Text = timeForUpdate
			if timeForUpdate == -1 then
				update = false
				end
		end
	end
end

Your script is a bit confusing, there are some instances that should be put in different areas

Try this?

local update = false
local timeForUpdate = 00

if update == false then
    update = true

    timeForUpdate = 60

    for Loop = 1, 59 do
        timeForUpdate -= 1
        script.Parent.Text = timeForUpdate
        wait(1)
    end

    update = false
end

Is there just an easier way in general? I don’t know why I couldn’t wave just used a simple loop…

You’re checking if the timeForUpdate is equal to 1, then setting it back to true which by default won’t work in relation with your first conditional check

You have to set it back to false if you want to activate it again

1 Like