I’m currently experimenting with procedural terrain generation and encountered an issue. I’m trying to generate a heightmap using math.noise, but for some reason every value it outputs is 0.
Here’s the code snippet in question (ignore the weird function at start and some other stuff that might grind your gears, it’s only there for debugging):
local seed = (function()
math.randomseed(tick())
return math.random(0,1000)
end)()
local Heightmap = {}
for x=1,100 do
local v = {}
Heightmap[x] = v
for y=1,100 do
v[y] = math.noise(x,y,seed)
print(x,y,seed,v[y])
wait()
end
end
Seems like a bug either in Studio or the engine. Replacing it with math.random seems to “fix” it, but I’m still trying to figure out whether anyone else also has this problem.