You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
The terrain generator I scripted works, but I want to prevent these holes from appearing, and these weird lines. I would appreciate any help.
-
What is the issue? Include screenshots / videos if possible!
I tried breaking the loop to prevent these massive holes from happening when you stop generating the terrain, but instead, it made the problem worse.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried using an if statement to break the loop, but it made the problem worse.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
function generate()
local positions = {}
local ypos
local totalx
local totalz
local zoom = 75
local height = 100
local size = 2048
for x = -30,size do
for z = -30,size do
local pos = CFrame.new(x,math.noise(x/zoom,z/zoom)*height+25,z)
ypos = pos.Y
table.insert(positions,pos)
local size = Vector3.new(1,1,1)
if (pos.Y>math.random(60,80)) then
workspace.Terrain:FillBlock(pos,size,Enum.Material.Rock)
elseif (pos.Y<math.random(1,5)) then
workspace.Terrain:FillBlock(pos,size,Enum.Material.LeafyGrass)
else
workspace.Terrain:FillBlock(pos,size,Enum.Material.Grass)
end
if(z>=1000-260 and pos.Y<2) then
totalz = z
break
end
end
if(x>=1000 and ypos<2) then
totalx = x
break
end
end
print(totalx,totalz)
workspace.Terrain:FillBlock(CFrame.new(totalx/2,30,totalz/2),Vector3.new(totalx*2,10,totalz*2),Enum.Material.Grass)
workspace.Terrain:FillBlock(CFrame.new(totalx/2,-2,totalz/2),Vector3.new(totalx*5,1,totalz*5),Enum.Material.Sand)
workspace.Terrain:FillBlock(CFrame.new(totalx/2,5,totalz/2),Vector3.new(totalx*5,5,totalz*5),Enum.Material.Water)
end
generate()
Any help is appreciated