So, recently i learned the basics of perlin noise and with the help of a youtube tutorial i managed to create a terrain generator. However, one issue with it is that it's not random, which is absolutely pointless.
Could anyone help me with this?
Script :
local X = 200
local Z = 200
local amplitude = 6
local resolution = 90
local frequency = 2
local Grid = {}
local function GenerateWater()
local water = game:GetService("ReplicatedStorage"):WaitForChild("Water"):Clone()
water.Parent = workspace
water.Anchored = true
water.Mesh.Scale = Vector3.new(100000, 250, 100000)
water.Position = Vector3.new(0, -335, 0)
water.CanCollide = false
water.Transparency = 0.5
water.Material = Enum.Material.Water
water.BrickColor = BrickColor.new("Electric blue")
end
for x = 1, X do
Grid[x] = {}
for z = 1, Z do
Grid[x][z] = math.noise(x / resolution * frequency, z / resolution * frequency) * 125
end
end
for x = 1, X do
for z = 1, Z do
local YPos = Grid[x][z]
local block = game:GetService("ReplicatedStorage"):WaitForChild("Block"):Clone()
block.Anchored = true
if YPos < - 36 then
block.Material = Enum.Material.Sand
block.BrickColor = BrickColor.new("Cool yellow")
elseif YPos > 58 then
block.Material = Enum.Material.Cobblestone
block.BrickColor = BrickColor.new("Grey")
else
block.Material = Enum.Material.Grass
block.BrickColor = BrickColor.new("Bright green")
end
block.Position = Vector3.new(x * (block.Size.X - 74), (Grid[x][z] - 2) * amplitude, z * (block.Size.Z - 74))
block.Parent = workspace
end
end
GenerateWater()

2 comments
use math.random() or Random.new():Nextnteger() or Random.new():NextNumber()
oh yeah, i did not think of that, however there's an itsy bitsy problem. W h e r e d o i u s e i t ?