Parts not staying 'connected' to the base

Kinda hard to see, but when I move the mouse away from the grid spot, the part like rapidly moves up and down. What I am trying to create is it so the part will always be on the ground, not 0.1, 0.2, etc. off the ground. I’m trying to create a placement system and with this problem, placing it results in the part being placed in mid air (a few pixels above the base plate)

local renderStepped = runService.RenderStepped:Connect(function()
			if not startedPlacingWall then
				local mouseP = mouse.Hit.p
				pole1.CFrame = CFrame.new(roundVector(mouseP + Vector3.new(0, pole1.Size.X/2, 0), gridSize))*CFrame.Angles(0, 0, math.rad(90))
			else
				renderStepped:Disconnect()
			end
		end)

Here’s where I set the CFrame of the part. gridSize = 4 btw. RoundVector is:

function round(number, to)
    to = to or 1
    return math.floor(number/to + 0.5) * to
end

function roundVector(vector, unit)
    print(vector.Y)
    return Vector3.new(round(vector.X, unit), vector.Y, round(vector.Z, unit))
end

The print returns:

[6.5](x13)
[6.9438180923462]
[6.5](x8)
[6.832305431366]
[7.2280344963074]
[7.6154465675354]
[6.5](x3)
[6.5479564666748]

So the Y has like spasms. It should always be at 6.5.

It snaps to the grid correctly it’s just the Y is always jumpy.

Here’s another shot to hopefully show it better

The part should be on top of the closest cross section