How do i make a part stay on the grid and not be offset?

So basically i want my part to be on a grid and basically not be offset on it.
heres a more better explanation on this:

but I dont want the part to be in the middle of the grid

I tried to put blockers on the parts (part that does not let you put part) and find solutions everywhere in the developer hub but i cant find any

Code (LocalScript):

local debounce = false
local peashooter = nil
local mouse = game.Players.LocalPlayer:GetMouse()
local Grid = 3
script.Parent.Equipped:Connect(function()
	local new = game.ReplicatedStorage.peashooterbutred:Clone()
	new.Parent = script.Parent
	peashooter = new
	print(peashooter)
end)
script.Parent.Unequipped:Connect(function()
	if peashooter ~= nil then
		peashooter:Destroy()
		peashooter = nil
		print(peashooter)
	end
end)

script.Parent.Activated:Connect(function()
	local BlockedPart = true
	print("CLICK!")
	for i, v in pairs(peashooter:GetDescendants()) do
		if v:IsA("BasePart") then
			for i, par in pairs(v:GetTouchingParts()) do
				if par.Parent == workspace.Lanes then
					print("Lane Found!")
					BlockedPart = false
				end

				if par.Name == "Blocker" then
					BlockedPart = true
				end
			end
		end
	end
	if not BlockedPart then
		if debounce then return end
		debounce = true
		print("Success!")
		script.Parent.PlantPlace:FireServer(CFrame.new(math.floor((mouse.Hit.X+Grid/2)/Grid)*Grid, mouse.Hit.Position.Y + 3.3, math.floor((mouse.Hit.Z+Grid/2)/Grid)*Grid))
		for i = 0,100 +1 do
			script.Parent.Name = "Peashooter Cooldown: ".. i
			wait(0.1)
		end
		script.Parent.Name = "Peashooter"
		debounce = false
	end
end)

while wait() do
	if peashooter == nil then
	else
		
		peashooter:PivotTo(CFrame.new(math.floor((mouse.Hit.X+Grid/2)/Grid)*Grid, mouse.Hit.Position.Y + 3.3, math.floor((mouse.Hit.Z+Grid/2)/Grid)*Grid))
	end
end

Code (Script to spawn because why not):

script.Parent.PlantPlace.OnServerEvent:Connect(function(player, Position)
	local plant = game.ReplicatedStorage.Peashooter:Clone()
	plant.Parent = workspace.Plants
	plant:PivotTo(Position)
end)

If you can/tried to help me thank you
If you need more information just tell me

I solved the problem by using this tutorial: How to make a working Grid System in Roblox