Looking for feedback on more accurate wait() I made(faster than task.wait())

hello, so I recently found out how to make a more accurate wait. It’ll basically add task.wait onto a value. Then a repeat loop will yeild the script until the value goes to the value I want. I’d like some feedback on it plz.

local Start = 0
local StartTime = tick()
repeat Start += task.wait() until Start >= 4
print(string.format("finished in: %s", tick() - StartTime))

it printed:
image

so it’s like 100% accurate! i appreciate any feedback. thx

1 Like

fun fact this is actually faster than the normal task.wait()!!

image

1 Like

This wait is more accurate, but I can’t help but think that is is a bit overkill. Using a repeat loop probably isn’t the greatest practice, especially for a difference of .0002 seconds. In most cases, this small latency won’t matter.

However, great job experimenting within the game engine. It’s always fun to discover new things :+1:

1 Like

it’s usually more faster than that. But also over time that 0.002 can stack and make it unaccurate. I did it with my stopwatch thing and it was way more accurate than doing task.wait()

1 Like

“I made a more accurate wait(). How did I do it? I repeatedly added task.wait()'s until the time was reached!”

Uh… like @Infinite_Visions stated this is probably overkill and task.wait() should be just fine.

image

There’s also no real conclusion on if your method is faster. I get just about the same exact values (4.0005 - 4.012) whether I do task.wait() or the custom wait.

image

2 Likes

:rofl: that’s true. I was simply asking for feedback on it and it’s still more accurate.

1 Like

There’s not enough evidence to tell which is faster. Spreading misinformation in any form doesn’t help anyone. A custom wait would’ve been faster before the task library came out, because wait()'s default was 1/30th of a second, a custom wait with game["Run Service"].Heartbeat:Wait() would’ve been “faster.”

Your custom wait is just returning the elapsed time given by task.wait():
image

And adding them up until the seconds you want to elapse is reached. Not only is this counter-intuitive, since print(task.wait(4)) would also give you the elapsed time, but there’s also no real time difference. It’s also pretty negligible.

1 Like

ok, I didn’t know that. Thx for the information.