Flat Generated Terrain

  1. What do you want to achieve?
    I want it so when you load into the game, my model is generated as terrain, but it’s all flat. I also want it so when you walk further, the terrain generates into that direction.

  2. What is the issue?
    The issue is, that all I have is okeanskiy’s work, which is all good, but it generates up and down, also with sand which I don’t want. I want it to use my custom model.

  3. What solutions have you tried so far?
    I looked on here, but it seems that nobody has actually got any answers to what I in particular want.

image

Terrain Script

local X = 50
local Z = 50

local grid = {}

for x = 1, X do
	grid[x] = {}

	for z = 1, Z do
		grid[x][z] = math.noise(x/10, z/10) * 15
	end
end

for x = 1, X do
	for z = 1, Z do
		local yPos = grid[x][z]

		local part = Instance.new("Part")
		part.Anchored = true

		if yPos < -3 then
			part.Material = Enum.Material.Sand
			part.BrickColor = BrickColor.new("Cool yellow")
		else
			part.Material = Enum.Material.Grass
			part.BrickColor = BrickColor.new("Bright green")
		end

		part.Position = Vector3.new(x*5, yPos, z*5)
		part.Size = Vector3.new(5, 30, 5)
		part.Parent = workspace
	end
end

RandomVsNoise Script

print("10 RANDOM NUMBERS:")
for i = 1, 10 do
	print(math.random())
end

print("10 NUMBERS GENERATED FROM NOISE")
for i = 1, 10 do
	print(math.noise(i/10))
end