I am not sure why is it producing that little gap on this hexagon generator script.
Provided picture: https://gyazo.com/674e2a451561179a638470f7c16b2145
Provided model: https://www.roblox.com/my/item.aspx?id=932301764
function MakeHexTerrain(dummy, rows, columns, parent)
local currentRow = 1;
local currentColumn = 1;
dummy.Parent = parent;
local StartPos = dummy.CFrame;
for Row = currentRow, rows do
wait();
local row = dummy:Clone();
row.BrickColor = BrickColor.new('Really red');
row.Parent = parent;
local rowPosition = row.CFrame;
local rowSize = row.Size;
row.CFrame = rowPosition * CFrame.new(0, 0, rowSize.Z * Row);
if Row%2 == 0 then
row.CFrame = row.CFrame * CFrame.new(row.Size.X/2,0,0)
end;
rowPosition = row.CFrame;
for Column = currentColumn, columns do
wait();
local column = dummy:Clone();
column.BrickColor = BrickColor.new('Forest green');
column.Parent = parent;
local columnPosition = column.CFrame;
local columnSize = column.Size;
column.CFrame = rowPosition * CFrame.new(columnSize.X, 0, 0);
rowPosition = column.CFrame;
end;
end;
end;
MakeHexTerrain(workspace.Hexagon, 10, 10, workspace);
I know the generator is innacurate, but I am unsure on why is it producing a gap like that.

6 comments
Could you provide a screenshot? I don't have your hexagon object so it's just doing it with parts. Pretty sure the problem is the condition on line 14, though..
Oh, I'm sorry, let me update.
It's difficult to figure a solution without the specific object.. could you link to a model on roblox or something?
There you go, and sorry once again.
I have to go for now but this question intrigues me and i'll be sure to answer later if it hasn't been already.
Okay, thanks Goulstem!