I have a terrain generator, and it generates terrain forever. But when it continues to generate terrain for some reason there are random holes in the map, why does it do this?
Here is the code:
local Part = game.ServerStorage:WaitForChild("GrassBlox") --For cloning Part.Anchored = true Part.FormFactor = "Custom" Part.Size = Vector3.new(1, 2, 1) local seed = math.random(1, 10e6) local frequency = 2 local power = 10 local resolution = 100 local Iteration = 0 function GenMap(Offset1, Offset2) for x = 1, resolution do wait() for z = 1, resolution do local y1 = math.noise( (x*frequency)/resolution, (z*frequency)/resolution, seed ) local y2 = math.noise( (x*frequency*.125)/resolution, (z*frequency*.125)/resolution, seed ) local y3 = math.noise( (x*frequency*4)/resolution, (z*frequency*4)/resolution, seed ) local y = (y1*y2*power*power)+y3 local Part = Part:Clone() Part.Parent = game.Workspace Part.CFrame = CFrame.new(x + Offset1, math.floor(y + 0.5), z + Offset2) end end end while true do if not frequency == 2 and not frequency == 0 then frequency = math.random(frequency - 1, frequency + 1) elseif frequency == 0 then frequency = frequency + 1 elseif frequency == 2 then frequency = frequency - 1 end if not power == 2 and not power == 10 then power = math.random(power - 1, power + 1) elseif power == 2 then power = power + 1 elseif power == 10 then power = power - 1 end Iteration = Iteration + resolution GenMap(Iteration, 0) seed = math.random(seed - 1, seed + 1) wait(10) end