Grid System Fill

I am trying to get my grid to get ontop of the GridBase, however I don’t know the formula for moving it there.

local xRow = GridBase.Size.X / GridPart.Size.X
local zRow = GridBase.Size.Z / GridPart.Size.Z

local gridCorner = GridBase.Position/2 -- This is what I currently have but idk how to manipulate this

for x = GridPart.Size.X,GridBase.Size.X,GridPart.Size.X do
	for z = GridPart.Size.Z,GridBase.Size.Z,GridPart.Size.Z do
		local newPart = GridPart:Clone()
		newPart.Parent = GridBase
		newPart.Position = gridCorner + Vector3.new(x,1.25,z) -- Movement
	end
end
newPart.CFrame = GridBase.CFrame * CFrame.new(x,0,z)

This is the result of that:

for x = -GridBase.Size.X/2,GridBase.Size.X/2,GridPart.Size.X/2 do
	for z = -GridBase.Size.Z/2,GridBase.Size.Z/2,GridPart.Size.Z/2 do
		local newPart = GridPart:Clone()
		newPart.Parent = GridBase
		newPart.CFrame = GridBase.CFrame * CFrame.new(x,0,z)
	end
end

Try this

Found a solution:

local gridCorner = GridBase.Position - (GridBase.Size/2)

for x = 0,GridBase.Size.X - GridPart.Size.X,GridPart.Size.X do
	for z = 0,GridBase.Size.Z - GridPart.Size.Z,GridPart.Size.Z do
		local newPart = GridPart:Clone()
		newPart.Parent = GridBase
		newPart.Position = (gridCorner + Vector3.new(x,GridBase.Position.Y + 0.01,z)) + GridPart.Size/2
	end
end