How do I convert this to 3D noise / 3D terrain generation?

So I recently learned noise and how it works, but I’m a bit stuck on how to convert 1D noise to 3D noise. My script right now graphs 1D noise but I want it to start making 3D noise like terrain generation. Here is my script:

local YOff = 0
local Inc = 0.1
local XOff = 0
local ZOff = 0

while true do
	wait()
	local Clone = script.Parent:Clone()
	Clone:FindFirstChild("Script"):Destroy()
	Clone.Parent = game.Workspace
	Clone.Position = Vector3.new(script.Parent.Position.X,math.noise(YOff) * 50,script.Parent.Position.Z)
	script.Parent.Position += Vector3.new(0,0,3)
	YOff += 0.01
end

Pass the X and Z position of the current terrain position as arguments to math.noise.

I’m not sure what this line is doing, though. Won’t all the clones’ XY positions be the exact same?

The basic principle though:

for x = 1, 100 do
	for z = 1, 100 do
		local position = Vector3.new(x, math.noise(x, z), z)
		print("Add part at", position)
	end
end

Oooh tysm. So you basically just loop through x y and z and you kinda graph one more layer each time and eventually it will look like hills. Correct me if I’m wrong.

Not quite. It’s more like

  1. Create a flat 1-part-high layer of cubes
  2. Offset each of those cubes in that layer on the Y axis by math.noise(x, z)

That will give you the top surface of the terrain. You can modify step 2 to also fill in the space underneath those parts, if you wish.