#more accurate task.wait()

1 messages · Page 1 of 1 (latest)

forest bough
#

alr so i have an UI game

on the client side:
64 frames get tweened across the screen in 8 seconds and the player has to press stop to select one.

on the server side:
as kind of an anticheat measure i want the server to independently count how many frames pass to kind of ensure players aren't just exploiting and setting the frame positions themselves.

Anyways the counter has to be very accurate the only issue is

local count = 0
while isRolling do
  count += 1
  task.wait(0.125)
end

this wont work because task.wait() does not support 3 decimal places. it will just floor the value to '0.12'

how else could i count with more accuracy?

#

also side note there is a 5 second timer meaning if you don't press 'stop' it will automatically stop for you after the 5 seconds and wont actually get to the end of the 8 second tween anyways - this is not really relevant to the question tho

silver sapphire
#

os.clock

#

or tick

#

one of those

#

theyre verya ccurate

#
repeat task.wait() until (tick() - startTime >= 0.125) ```
#

maybe something like this

#

or you could do a while loop

frigid cairn
#

wait does os.clock even work on the server

silver sapphire
#

yes

#

idk the difference between osclock or tick

frigid cairn
#

os.clock is uh

#

the clock cycles of ur pc or smth idk i forgot

#

and i think

#

tick is like

#

idk

#

💔

silver sapphire
#

coool

frigid cairn
silver sapphire
#

like a timer module?

frigid cairn