Grid Snapping DOES NOT work on objects with floating points

I have a problem with my grid snap placement as shown in the video below.

As you can see in the attached video below I demonstrate the grid snapping functioning perfectly fine from around the time 0:10 to 0:30.

Then after the 0:30 mark I hover over the unanchored object which contains floating points in the position which completely destroys the grid snapping

Floating Points on object:
image

Video:

Code Snippet:

local targetPart : BasePart = raycastResult.Instance
local position : Vector3 = raycastResult.Position
local normal : Vector3 = targetPart.CFrame:VectorToObjectSpace(raycastResult.Normal).Unit
			
local target = position	
target = targetPart.CFrame:PointToObjectSpace(target)
target += normal * (blockHologram.Size.X / 2)
			
local X = normal.X == 0 and RoundToNearest(target.X, blockHologram.Size.X/2) or target.X
local Y = normal.Y == 0 and RoundToNearest(target.Y, blockHologram.Size.Y/2) or target.Y
local Z = normal.Z == 0 and RoundToNearest(target.Z, blockHologram.Size.Z/2) or target.Z
			
target = Vector3.new(X, Y, Z)
			
target = targetPart.CFrame:ToWorldSpace(CFrame.new(target))
			
blockHologram.CFrame = target * CFrame.Angles(0, math.rad(Rotation), math.rad(Tilt))

I would appreciate any help for this, thanks!

fixed the old problem but a new one appeared…