Game issue question

I am not sure if this belongs in this category but I am making a pc stress tester where it spawns a bunch of parts and my problem is when I end the test it has to delete the parts obviously but sometimes it does delete it and sometimes it doesn’t. Could this issue be bc of lag?

1 Like

Object creation and destruction is slow.

When you close a game after 1000s of objects have been created the program has to clear up and free lots of memory which can cause a big hitch or freeze the program for a short time.

If you want to prevent this you gotta clean up some objects before the game closes.
You could remove 20 objects every 0.1 second for instance which I think should at least reduce the lag a bit.

I use a part to remove the objects and also I don’t close the game but click a button to end the test

Ending the test is equal to closing the game.
For now if you want to get rid of the lag spikes you’ll have to incrementally remove parts automatically.

There is a button the player presses which stops the loops and starts deleting the parts. It doesn’t kick them out of the game

Some code look at might be helpful.

And in that case, you should put this request in ScriptingSupport.

Wdym code look at? The code is just a loop of spawning parts.