This might be happening because the tick() time from the client gets a bit outdated by the time it reaches the server, especially outside the studio. In the studio, the delay is tiny.
I figured out a solution by just doing currenttick = tick() instead, however i am wondering why does it work in singpleplayer studio and not multiplayer?