Help with grid system for truck

So I’m trying to make a grid for things like crates. But I have trouble creating the grid. Look below. The grid isn’t supposed to be going over the boundary

local TruckLoad = script.Parent
local LoadSize = TruckLoad.Size
local GridSize = Vector3.new(2,2,2)

for i = 0, TruckLoad.Size.X/GridSize.X*GridSize.X, GridSize.X do
	for j = 0, TruckLoad.Size.Z/GridSize.Z*GridSize.Z, GridSize.Z  do
		local Part = Instance.new("Part")
		Part.Anchored = true
		Part.Size = Vector3.new(2,.2,2)
		Part.Position = Vector3.new(TruckLoad.Position.X - TruckLoad.Size.X/2+i, TruckLoad.Position.Y+.2, TruckLoad.Position.Z - TruckLoad.Size.Z/2+j)
		Part.BrickColor = BrickColor.Green()
		Part.Parent = TruckLoad
	end
end