Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to use math.noise with terrain?

Asked by 3 years ago
Edited 3 years ago

Hello everyone :D I have recently been working on random terrain generation (like Minecraft) with the ROBLOX terrain system. My aim is to try to add lakes in ditches and add sand around them, here is my script (it is a script inside of ServerScriptService):

local xScale = 50
local zScale = xScale
local height = 20

local noise = math.noise
local t = workspace.Terrain
local setCell = t.SetCell

local seed = math.random(0,1)

for x = -200,200 do
        wait()
    for z = -200,200 do
        local y = noise(seed,x/xScale,z/zScale) * height
            setCell(t,x,y,z,1,0,0)
        setCell(t,x,y-1,z,1,0,0)
        end
    end
print("Terrain finished.")

Thank you in advance!!

Answer this question