I am trying to generate a mountain using math (simply) but it is turning into a tarpaulin more than a mountain code

for Number = -50, 50 do
for Number2 = -50, 50 do
local Y = Number * -Number / 25 + Number2 * -Number2 / 25 + 200
local Part = Instance.new("Part")
Part.CFrame = CFrame.new(Number * 5, Y, Number2 * 5)
Part.Anchored = true
Part.Size = Vector3.new(5, 5, 5)
Part.Parent = workspace.Terrain
end
end

I’d suggest using Perlin Noise instead of local Y = Number * -Number / 25 + Number2 * -Number2 / 25 + 200. ThinMatrix has made terrain with Perlin Noise before, this is what it looked like:

In my opinion this is a pretty good tutorial on how to generate procedural 3D terrain. Even though that tutorial is for Java, it can be translated to Lua for use in Roblox.

Try this. The only change I made was calculating “Y”, you only want the first for loop to be for the y axis, and the second for loop to be for the X and Z axis.

for Number = -50, 50 do
for Number2 = -50, 50 do
local Y = Number2 * -Number2 / 12.5 + 200
local Part = Instance.new("Part")
Part.CFrame = CFrame.new(Number * 5, Y, Number2 * 5)
Part.Anchored = true
Part.Size = Vector3.new(5, 5, 5)
Part.Parent = workspace.Terrain
end
end

local MAXHEIGHT = 100
local RANGE = 50
local MAXRANGE = math.sqrt(2*range^2)
local dist, percentage
for x = -RANGE, RANGE do
for z = -RANGE, RANGE do
dist = math.sqrt(x^2+z^2)
percentage = dist/MAXRANGE
--here you could just do: y = (1 - percentage) * MAXHEIGHT
--But lets smoothen the curve abit
y = (1 + math.cos(percentage * math.pi)) * .5 * MAXHEIGHT
end
end