Generation Problem Need Help

How would i make it so the next cube isnt in the same pos and the other one?

local Y = 2
local X = 2
local Z = 10

while true do
local Offset = 2
for i = X+Offset,0,-1 do
for s = Y+Offset,0,-1 do
for d = Z+Offset,0,-1 do
local part =Instance.new(“Part”)
part.Parent = workspace
part.Size = Vector3.new(1,1,1)
part.Anchored = true
part.Position = Vector3.new(X+Offset,Y+Offset,Z+Offset) +Vector3.new(i+Offset,s+Offset,d+Offset)
wait()
end
end
end
Offset = Offset+2
end
if u have any suggestions please tell

local offset = CFrame.new(prevCube.Size.X/2, 0, prevCube.Size.Z/2) nextCube:PivotTo(prevCube:GetPivot() * offset)

Something like that I think. You can make the x,z positive or negative to choose which direction relative the previous cube. Negative X would be forward. In the example, I moved it both on the x and z axis so that would move it diagonally. The cube size used is cut in half because we are moving based on the center position. If you use full size it will have space between them equal to half the size.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.