Model placement query

I have a model that I am attempting to clone beside each other. I’ve gotten so far as to get the models close to what I need but I am unsure how to complete the calculations so that each model is in the correct position. I intend to do this on all sides eventually but I want to get the first side complete. As you can see the first model is correctly located but when I try to loop more in they overlap.

	--This script should place the boxes along the side of the
	--starter area.
local RS = game:GetService("ReplicatedStorage")

local boxFolder = RS:WaitForChild("BoxFolder")
local box = boxFolder:WaitForChild("Box")
local boxes = workspace.Boxes
local floorArea = workspace.FloorArea

local function getStartCoord()
	--get the size of the placement area
	local floorSizeX = floorArea.Size.X
	local floorSizeY = floorArea.Size.Y
	local floorSizeZ = floorArea.Size.Z
	local setY = floorSizeY/2 + floorSizeY/2 --top of the floor area
	--get the corner position at the top of the floorarea
	local StartCornerA =, setY, -floorSizeZ/2)
	--local newPart ="Part")
	--newPart.Size =,4,4)
	--newPart.Color =,0,0)
	--newPart.Anchored = true
	--newPart.Position = StartCornerA
	--newPart.Parent = workspace
	return StartCornerA

local function getPlacementPosition()
	--get the position of each box position
	--loop through at least 10 boxes for one side
	--get the other sides after one side is correct
	local startSpot = getStartCoord()
	local floorSizeX = floorArea.Size.X
	local boxSizeX = box.BoxBase.Size.X
	local numberOfSpawns = math.floor(floorSizeX / boxSizeX)
	--print("The number of boxes that can spawn is: ", numberOfBoxes)
	--calculate first box position
	--local coordY = boxClone.PrimaryPart.Size.Y/2
	--local coordX = boxClone.BoxBase.Size.X / 2
	--local coordZ = - boxClone.PrimaryPart.CFrame.Z).Magnitude
	--boxClone:PivotTo( +,coordY,coordZ - coordZ + 6))
	--boxClone.Parent = boxes --boxes folder in workspace
	for i = 1, numberOfSpawns do
		local boxClone = box:Clone()

		local coordY = boxClone.PrimaryPart.Size.Y/2
		local coordX = boxClone.BoxBase.Size.X / 2
		local coordZ = - boxClone.PrimaryPart.CFrame.Z).Magnitude
		boxClone:PivotTo( + * i,coordY,coordZ - coordZ + 6))
		boxClone.Parent = boxes --boxes folder in workspace
		--how to fix boxClone overlapping?

local function modifyBoxes()
	--modify box properties
	--set box mechanics
	--apply new texts and labels


I apologize for the formatting of the code (WIP)