How can i use DeltaTime to make better timers?

I saw there is a way of using DeltaTime to make timers that can compensate for FPS drops, and in general just be better than using wait(), but i don’t know how to apply it.

I’ve looked into the DevHub and into some topics, still can’t visualize whats going on; i’m very confused. Can anyone explain it in detail?

I’m trying to make a function does something exactly every one second, forever on

Hi! I recommend reading this page:


As it explains that very well, it will definetly help you!

1 Like

While DeltaTime is a solution to your question, I would personally recommend using ticks instead of DeltaTimes.

Ticks will help compensate for FPS drops, lag and any other sort of freeze time between frames.
I personally have used ticks for live timers and I am yet to see a flaw with them.

You can most likely get an accurate timer by using the CurrentTick - StartTick method.
Example:

local StartTick = tick();
wait(1)
print(tick() - StartTick.." seconds have passed!")
1 Like

in physics for each time step we get the time dilation and multiply that by our acceleration.