My game has 3D effects like blocks, spheres, meshparts that get “animated” using CFrames as well as having there size, transparency and even color updated. this all happens at 60fps (regardless of your actual frame rate)
This is all fine but when you have hundreds or even thousands of these effects the lag sets in fast. they are all done using coroutines and such and are all on the client. the loop part could probably be optimized I just don’t know how to go about that
Here is the loop that animates the effects(note this runs per effect)
I have tried things like assigning stuff like CFrame.new() to a local variable and using += and -= I don’t actually know if that helps but it seems to. but I’m sure there is alot of ways to make code like this run alot faster(as I would like to do this with other code that is like this as well) it would be nice to learn some tips on how to optimize this kind of stuff.
also a thing I have noticed is I end up using lots of if statements. I’m not sure the performance impact of having lots of if statements like that but I imagine it is not good.
