Hello.

I'm building a race-track generator that simply duplicates 3 models. A start model, middle model, and an end model. When I tried this script with only parts it worked perfectly. And I'm able to make it semi-working with models but at seemingly random intervals(The only factor that changes this is the size of the models) it goes 1-2 studs higher.

-- Video Demonstrating Glitch: https://www.youtube.com/watch?v=EE5frRykAeA&feature=youtu.be

-- Code

local runTimes = 50


local lobby = script.Parent

local serverStorage = game:GetService("ServerStorage")
local trackFolder = serverStorage:WaitForChild("Tracks") 



local start = trackFolder.Start
local middle = trackFolder.Middle
local endPart = trackFolder.End




for i = 1,runTimes do
	if i == 1 then
		local cloneStart = start:Clone()
		cloneStart.Parent = game.Workspace
		cloneStart.Name = "Track"..i 		
		local moveTo = Vector3.new((lobby.Size.X/2 + cloneStart.PrimaryPart.Size.X/2),0,0) + lobby.Position
		cloneStart:MoveTo(moveTo)
	else if i > 1 and i < 50 then
			local last = workspace:FindFirstChild("Track"..i - 1)
			local middleClone = middle:Clone()
			middleClone.Parent = workspace
			middleClone.Name = "Track"..i
			
			local moveTo = Vector3.new((last.PrimaryPart.Size.X/2 + middleClone.PrimaryPart.Size.X/2),0,0) + last.PrimaryPart.Position
			middleClone:MoveTo(moveTo)
			
		else 
				local lastBrick = workspace:FindFirstChild("Track"..i - 1)
				local endClone = endPart:Clone()
				endClone.Name = "TrackEnd"
				endClone.Parent = workspace
				local moveTo = Vector3.new((lastBrick.PrimaryPart.Size.X/2 + endClone.PrimaryPart.Size.X/2),0,0) + lastBrick.PrimaryPart.Position
				endClone:MoveTo(moveTo)
			
		end
	end
end