Script activity is about 85% during game loading

I am making a terrain generation system that iterates through a 3 dimensional array and a few others. I am using Heartbeat:Wait() to achieve fast iteration times and script activity is through the roof at about 85% and rate is also about 130/s, and this script runs twenty times (it is cloned 20 times), taking about 48 seconds to run all twenty, and it only happens once at server start.

Apparently, a very high script activity is really bad, as in, anything above 3-5%, but my inkling is that this falls outside of that general rule because the game is loading and there should not be anything else running at that time. Am I correct in this?

I have optimized my code with a bunch of local function assignments and used other code optimization techniques to minimize the impact, but it’s still that high.

1 Like

48 seconds are a long time for a roblox game.
To fix the problem just add a loading screen

Turns out the server really enjoys crashing from it :sweat_smile:
I’ve fixed the issue, though. Interestingly enough I removed the heartbeat:wait()s that I had in the loops, so now they are running full-hog which I would’ve thought it would result in a crash since its spitting distance from being an infinite for-loop, but I guess not.