My building system is not working right

I am making a block building system for a scrap mechanic like game.

i have no clue how to explain this very well but it only places the blocks on the positive xyz axis when placing blocks on other blocks.

It uses MoveTo() because its the only way I know to move models, if there is another method, please let me know.

I don’t really know if its my grid system or MoveTo() is being used wrong

Script: (In StarterGui)

local StarterGui = game:GetService("StarterGui")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local CAS = game:GetService("ContextActionService")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local mouse = Player:GetMouse()

local GridSize = 2

local	PartClass = "Block"

local Part = ReplicatedStorage.BlockPreviews[PartClass]:Clone()
Part.Name = "PlacementPart"
--Part.Anchored = true

function Snap(HitPos, ModelSize)
	return Vector3.new(
		math.floor((HitPos.X + ModelSize.X/2)/GridSize + 0.5) * GridSize - ModelSize.X/2,
		math.floor((HitPos.Y + ModelSize.Y/2)/GridSize + 0.5) * GridSize - ModelSize.Y/2,
		math.floor((HitPos.Z + ModelSize.Z/2)/GridSize + 0.5) * GridSize - ModelSize.Z/2)
end

if script.IsPlacing.Value == true then
	Part.Parent = workspace
	
	mouse.Move:Connect(function()
		Part:MoveTo(Snap(mouse.Hit.Position, Part.OutlineHitbox.Size))
		mouse.TargetFilter = Part
	end)

	function Placer(actionName, inputState, inputObject)
		if actionName == "PlaceObject" and inputState == Enum.UserInputState.Begin then
			local CPart = ReplicatedStorage.Blocks[PartClass]:Clone()
			CPart.Parent = workspace
			CPart:MoveTo(Part.OutlineHitbox.Position)
			CPart.Name = "PlacedObject"
			Part:MoveTo(Snap(mouse.Hit.Position, Part.OutlineHitbox.Size))
			mouse.TargetFilter = nil
		end
	end
	CAS:BindAction("PlaceObject", Placer, true, Enum.KeyCode.E)
else
	CAS:UnbindAction("PlaceObject")
end

The blocks in replicatedStorage.
RobloxStudioBeta_HEmHCQyl00
Positive axis (What I want to happen on the negative)
Positive
Negative Axis
Negative

2 Likes