Basically I wish to use Perlin Noise, thanks to BlueTaslem, for terrain generation using bricks. Below is the script.
Since I'm not experienced with Perlin Noise, I decided to look into it a little, but didnt find much that I understood, nor how to use correctly. So any assistance with changing the values slighty and getting more "biomes" would be appreciated.
If you don't want to write code for me that's fine, I just want guided on the right path :)
local worldX = 100
local worldZ = 100
local blockWidth = 2
local blockHeight = 2
local model = Instance.new("Model")
model.Parent = game.Workspace
model.Name = "TerrainParts"
for _, obj in pairs(workspace.TerrainParts:GetChildren())do
if obj:IsA("Part") and obj.Name == "TerrainBlock" then
obj:Destroy()
end
end
function height(x, y) -- The Spot That Uses Perlin Noise
return (math.noise(x/20, y/20) + math.noise(x/35, y/35) + math.noise(x/77, y/77)) * 10 + 10
end
for x = 0, worldX, blockWidth do
for z = 0, worldZ, blockWidth do
local brick = Instance.new("Part")
brick.FormFactor = "Custom"
brick.Anchored = true
brick.Size = Vector3.new(blockWidth, blockHeight, blockWidth)
local y = math.random() + 4
brick.Position = Vector3.new(x, height(x, z), z)
brick.BrickColor = BrickColor.Green()
brick.TopSurface = 0
brick.Name = "TerrainBlock"
brick.Parent = game.Workspace.TerrainParts
wait()
end
end
~ Legobuildermaster
