You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Dirt hidden from terrain surface
-
What is the issue?
-
What solutions have you tried so far? Changing values and operators Did you look for solutions on the Developer Hub? No
Here is the script for terrain generation
local cache = workspace.Cache -- Folder
local length = 50
local width = length
local height = 50
local size = 4
local resolution = 50
local amplitude = 5
local frequency = 2
local seed = Random.new():NextInteger(0,10000)
for x = 0, length do
for y = 0, height do
if y == 10 then task.wait() end
for z = 0, width do
local xNoise = math.noise(y/resolution*frequency,z/resolution*frequency,seed)*amplitude
local yNoise = math.noise(x/resolution*frequency,z/resolution*frequency,seed)*amplitude
local zNoise = math.noise(x/resolution*frequency,y/resolution*frequency,seed)*amplitude
local density = math.floor(xNoise + yNoise + zNoise + y)
if density <= 20 then
local part = Instance.new("Part")
part.Size = Vector3.new(size,size,size)
part.Position = Vector3.new(x*size,y*size,z*size)
part.Material = Enum.Material.SmoothPlastic
part.Anchored = true
part.Parent = cache
if density <= 20 and density >= 19 then
part.BrickColor = BrickColor.new("Forest green")
--createPart(x,y,z,"Forest green")
elseif density <= 19 and density >= 16 then
part.BrickColor = BrickColor.new("CGA brown")
--createPart(x,y,z,"CGA Brown")
elseif density < 16 then
part.BrickColor = BrickColor.new("Medium stone grey")
--createPart(x,y,z,"Medium Stone Grey")
end
end
end
end
task.wait()
end