I’m having a very weird issue. The following code has not been altered lately (besides debug attempts), yet now it is causing severe lag spikes when called. A call to this function is performed every 2 seconds and the game freezes up when this is done. This never happened before.
Is there some quirk to :Clone() that causes lag? Could it be the position randomizer?
Is it possible that you can attach a .rbxm file with the assets needed for this script to work? Alternatively, you could try testing this by itself in a separate game to see if it’s what’s causing the problem.
The game initializes with a core script that loads required modules and calls a prewarm() function. This loads the assets.
The game then runs the launch() function. Starting the execution of each script on its own thread.
One of the scripts that gets launched is a PlotManager. Which spawns said fireflies every x seconds.
The code that you see there sits inside of a function that spawns the firefly.
So theoretically there shouldn’t be any reason this is freezing the game. One theory I have is that there are too many objects in the game simultaneously. But all of these objects are anchored. Very bizarre.