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

The top of my terrain is flat. How can I resolve this?

Asked by 6 years ago

The problem is that at the top of the grid it cuts off. I expected this to happen, but I don't know how to fix it.

Here is an image of what I mean: http://prntscr.com/jkdit7

This is my code so far.

scale = 3
local folder = Instance.new("Folder")
folder.Parent = workspace
folder.Name = "Parts"

local rs = game:GetService("RunService")

chunk = {}

for x = 1,100 do
    chunk[x] = {}
    for y = 1,25 do
        chunk[x][y] = {}
        for z = 1,100 do
            density = math.noise(x*0.1, y*0.1, z*0.1)
            chunk[x][y][z] = density
            if chunk[x][y][z] >= 0 then
                local part = Instance.new("Part")
                part.Parent = folder
                part.Size = Vector3.new(scale, scale, scale)
                part.Anchored = true
                part.CFrame = CFrame.new((x-1)*scale, (y-1)*scale, (z-1)*scale)
            end
        end
    end
end


Answer this question