Random Part Generation

This method might be a bit complicated but its fairly straight forward, And that method is taking advantage of the math.noise function to create a Perlin noise pattern (for a more in depth explanation check out Understanding Perlin Noise) or (Basics of using Perlin Noise (2D Based)) But what it basically does is, Create a pattern that is very smooth in transitioning without any sharp cuts. With that being said you can use it to create cool smooth patterns which is exactly what everyone would be looking for in terrain creation.
So here is a simple Example on how to utilize it.

for x = 1, 100 do
    for z = 1, 100 do
        local height = (math.noise(x / 20, z / 20) + 2) * 50 -- this will create the pattern with that smooth transition to CFrame the Y value of the Generated parts to
        local p = Instance.new("Part", workspace)
        p.Locked, p.Anchored = true, true
        p.Size = Vector3.new(4, height, 4)
        p.CFrame = CFrame.new(4 * x, height / 2, 4 * z) -- CFraming the Instance to our generated Height 
        wait()
    end
end

Also, Its really fun to mess aound with the values and expect random outcomes everytime, Screw around with it. Hope that helped! (if you need further assistance don’t hesitate to pm me)

5 Likes