This is from a previous question I asked about 2 weeks ago on how to make a generation script have less activity on the server/client. It does reduce the amount of the activity by at least 25-30% (Reduced from 75-80% to 60-40% [Estimate values/numbers]). However, sometimes the script takes forever to generate. Time ranging from 8.5 mins - 12 mins. This is too long of a wait. So was wondering if there is any other way to substitute a nested for loop and keep the script's activity on the server/client below at least 30% if it is even possible. This is the only way I could think of to generate a Vector3 (x, y, z) cube. Note: function GeneratePart calls a function to clone the part and calculates the position of it.
local SpawnCount = 0
for y = 1, 30 do
for x = 1, 20, 2 do
for z = 1, 20 do
GeneratePart(x, y, z)
GeneratePart(x + 1, y, z)
SpawnCount = SpawnCount + 5
if SpawnCount >= 10 then
wait()
SpawnCount = 0
end
end
end
end

2 comments
What is happening in GeneratePart()
Just cloning a part in serverstorage and putting it in workspace whilst calculating the part's position.