So, Im trying to create a procedural terrain generation, and I made a script that should work.
It uses perlin noise (math.noise) to determine the height of each part that is created, but the noise only returns 0 or -0. Im not sure why. Here is the code im using:
xcoord = 0
zcoord = 0
loopx = 0
loopz = 0
while loopz < 100 do
while loopx < 100 do
loopx += 1 -- step x values loop --
part = Instance.new("Part") -- create part --
part.Anchored = true
part.Parent = workspace
part.Size = Vector3.new(1,1,1)
part.CFrame = CFrame.new(Vector3.new(xcoord,math.noise(xcoord,0,zcoord),zcoord,math.random(1,100000)))
xcoord += 1
end
loopz += 1 -- reset x values and step z values --
loopx = 0
zcoord += 1
xcoord = 0
wait(0)
print("looped")
end
thanks!