So I have this game that has had a problem ever since I created it. In the game, I use task.wait()s in for loops to create strings of hitboxes. However, the longer you play, the longer the waits take. Additionally, players (especially laggy players) playing will accelerate the lag of the waits. I have tried monitoring the memory of the server and it seems to slowly go up, even if I’m just sitting in the lobby (not sure if this is normal).
I have tried several methods of reducing lag such as showing effects on the client, and other methods. Is there any way I can rid of this lag or atleast prevent gameplay from being affected by it? (I won’t show my script for now since this seems relatively straightforward. Please let me know if it is needed.)
Yep, what @Zer0Wit said. Memory leaks can be difficult to track down. Make sure you’re disconnecting event connections and that there aren’t any loops that keep silently running after they’re no longer needed.