My game is just lagging and i dont know why, i have a ton of scripts to know why

my game is just lagging when i join sometimes and sometimes not, i dont know why and i ahve a lot of scripts to specify which one is lagging the game, but what i know is that i have a lot of loops, while loops that are like this

while wait(0.001) do while wait(0.00001) do

but i dont think this is the reason my game is lagging any help will be appreciated

game is not published by the way, its just in roblox studio, so it might be from roblox studio, because when i just open roblox studio it dosent lag but after a long session of scripting it does

3 Likes

That happens sometimes to me. Close your work and save it, and then open studio again. The lag should fix.

2 Likes

You should do while task.wait(0.001)

Also try to minimize the amount of loops if possible. For example updating a currency UI only when the currency changes instead of every .1 Seconds. There are many different ways to avoid loops.

1 Like