Countdown script

how do i make a countdown script that doesn’t stop the rest of the code below it
i.e

timer = nil
for i = 10, 0, -1 do
      timer = i
      task.wait(1)
end

i’ve tried task.delay but it just makes it countdown instantly

i know this is probably really simple but i am beyond tired and cannot comprehend much

One way you can achieve that is to use task.spawn, like so:

task.spawn(function()
	timer = nil

	for i = 10, 0, -1 do
		timer = i
		task.wait(1)
	end
end)

By the way, taking brakes is important. The more tired you are, the more mistakes you make, and the more tired you get trying to fix those mistakes :slight_smile::+1:

2 Likes

thank you I appreciate it a lot, I was struggling with this at 1 in the morning. I can rest now, thanks!

1 Like

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