How can I destory many instances without lag spike?

Hello!
In my game I currently have many different items you can unlock.
When closing inventory a small lag spike occurs if you have 150+ items.
How could I destroy this Inventory frame without causing lag from the items apart of the frame.
They are all in a UIListLayout.

So far I have tried using Debris and also confirmed that the lag comes from destroying these frames alone.

1 Like

Move this to #help-and-feedback:scripting-support

But to answer your question, I would personally create a function that takes your list of instances and gradually destroys them in a spawned thread.

Just did that and it worked wonders.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.