Sometimes, this crashes the game because the load is too heavy. Is there a way I can incrementally load in all the terrain so it takes more time to load all of it in?
I was under the illusion that you were asking how to make a chunk loading system. Please be more clear on what exactly you are trying to accomplish.
Edit: I think I know of a way you can accomplish this, you could set the coordinates of the main square that you are trying to load, and instead divide it into sections.
i.e divide the vector values in a way like this, and have a loop load each chunk in order
Kinda made a drawing of how you could split up the chunks and then load them doing something like this, note this is pseudocode:
local ChunkDivisor = 3
for i = OriginalPositionY / ChunkDivisor, EndPositionY, OriginalPositionY / ChunkDivisor do
for i = OriginalPositionX / ChunkDivisor, EndPositionX, OriginalPositionX / ChunkDivisor do
-- Load particular chunk then move over 3
end
end