I have a basic script that allows for a given width and height of cubes, and for the baseplate size. Now what I was wondering is how to smooth the slopes, rather than using math.random to give me random heights.
local width = 2
local height = 2
local baseplate = {30, 30}
local model = Instance.new("Model")
model.Parent = game.Workspace
model.Name = "Terrain Parts"
local bricksRemove = game.Workspace:FindFirstChild("Terrain Parts"):GetChildren()
for num, obj in pairs(bricksRemove)do
if obj:IsA("Part") then
if obj.Name == "Terrain Blocks" then
obj:Destroy()
end
end
end
for i = 0, ((baseplate[1]/width)*(baseplate[2]/width))-1 do
local brick = Instance.new("Part")
brick.FormFactor = 3
brick.Size = Vector3.new(width, height, width)
brick.Position = Vector3.new((i%(baseplate[1]/width))*width, math.random()+4, math.floor(i/(baseplate[2]/width))*2)
brick.Anchored = true
brick.Name = "Terrain Blocks"
brick.Parent = game.Workspace:FindFirstChild("Terrain Parts")
end
I was debating whether getting blocks at certain intervals and using them to decide the incline/decline then smooth the blocks within a given range to that, but that didn't seem efficient. So if anyone has any information that will guide me into making smooth terrain, I would be grateful.
~ Legobuildermaster

1 comment
To anyone looking to answer, I believe I have found a way though it is more complicated. I'm going to use OOP and create parts using that, then using the directions, obtain a block in a certain direction, then base the height off of that part.