I have a chunk gen script that generates basic parts.However, I need to align the chunks to the side of currently existing chunks.How should i do this?
local Range = 5
local Offset_x = math.random(-100, 100)
local Offset_y = math.random(-100, 100)
local function createPart(x,y,alpha)
local Part = Instance.new("Part")
Part.TopSurface = Enum.SurfaceType.Smooth
Part.Size = Vector3.one
Part.Position = Vector3.new(x, alpha * Range, y)
Part.Parent = workspace
Part.Anchored = true
Part.BrickColor = BrickColor.new("Dark green")
end
local function createchunk()
local rows = 50
local cols = 50
for x = 1, cols do
for y = 1, rows do
local noise = math.noise(x/rows + Offset_x, y/cols + Offset_y, 0)
createPart(x, y, noise)
end
end
end
createchunk()