I am relatively new to roblox scripting, and I am making a terrain generation Script. I have looked up how to do it but no results. This would be really helpful because I need dirt to be under grass. Here is my script
--Variables--
mapxsize = 256
mapysize = 32
mapzsize = 256
seed = math.random(0, 1000000)
noisescale = 30
amplitude = 20
blocksize = 2
--The Script--
for x = 0,mapxsize do
for z = 0,mapzsize do
for y = 0,mapysize do
xnoise = math.noise(y/noisescale,z/noisescale,seed)*amplitude
ynoise = math.noise(x/noisescale,z/noisescale,seed)*amplitude
znoise = math.noise(x/noisescale,y/noisescale,seed)*amplitude
density = xnoise + ynoise + znoise + y
if density < 18 and density > 12 then
part = Instance.new("Part",workspace.TerrainFolder)
part.Anchored = true
part.Size = Vector3.new(blocksize,blocksize,blocksize)
part.CFrame = CFrame.new(x*blocksize,y*blocksize,z*blocksize)
end
end
end
wait()
end

4 comments
Yea. umm.... if your new to scripting doing something advanced IS NOT gonna help you, its gonna discourage instead. So start doing way easier stuff then progress fowards. You are most likely not gonna get help if you don't even try.
Wow! I kind of agree with 123nabilben. A terrain generating script is pretty advanced. I have been coding for over a year, and I still can't think of an approach.
I think there was a tutorial about random terrain generation in game called Lua learning By Boatbomber
you making minecraft?