Why does while true do go slow in servers with 20 players?

Im using while true do for a timer and it goes 0.2 seconds, but instead goes 1 second a light year

4 Likes

Are you using wait() or task.wait()? They are different, so to fix this issue you may use task.wait() instead.

3 Likes

can I ask, whats the difference? does task.wait rely on FPS? is it more efficient?

3 Likes

task.wait is an improved version of wait which schedules the current thread to be resumed after some time has elapsed without throttling.

See this post to get more info.

P.S. - basically, task.wait doesnt affected by throttling, so it’ll run faster than wait. Dont use wait as roblox doesnt recommend to do it, and it has 11 chances of 10 that wait will go deprecated.
This is the same as delay. As task.delay is more accurate than delay

4 Likes

Ill let you know when theres a big amount of players and its fixed

4 Likes

Show the code, you’re most likely doing something wrong because the speed of a loop is not dependant on the number of players.

4 Likes

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