Best way to build a 5 minute timer?

I have a script that I want to run five minutes into the game. What is the best way to do this? Should I just use

wait(300)

Is there no better option?

1 Like

Theres nothing wrong with Wait(300) that I can think of?

If you don’t want the entire script to halt you can use delay instead.

1 Like

task.wait(300) should be used or a custom wait

wait() is deprecated

you should use task.delay() instead of delay()

If you want to be completely accurate, you can use tick(). For example:

local waittime = tick() + 300 
repeat task.wait() 
until (tick() >= waittime) 
print("done!")
2 Likes

Thank you everyone! I learned a lot from this post.

You shouldn’t need to do this. Both will resume on heartbeat after 300 seconds have elapsed.

1 Like

Ooh, nice! The new task library is even better than I thought.