Snaping value with offset

I am attempting to add snaping for my placement systems Y-axis, by only allowing it to move in 1 stud intervals, however I want to do this with the surface it is on in mind using ray cast normals

Here is how I want it to work “Ideally”


The drawings indicate the 1 stud intervals relative to the ray cast normal vector (that being the top of this road here)

Here is the code that calculates a placeables position:

function Placeable.GetPlaceableSkeletonCFrame(raycastResult : RaycastResult, placeableObject : Model)
	local placeableBounds : BasePart = placeableObject.PrimaryPart
	local instance : BasePart = raycastResult.Instance
	local normal = raycastResult.Normal
	local position = raycastResult.Position
	
	local rayCFrame = CFrame.new(position) * instance:GetPivot().Rotation
	local offsetFromNormal = normal * placeableBounds.Size/2
	local offsetFromInstance = instance.CFrame:ToObjectSpace(rayCFrame * CFrame.new(offsetFromNormal))
	
    --The Y Cordinate I want to be snaped 
	local y = math.round(offsetFromInstance.Position.Y) + math.fmod(placeableBounds.Size.Y, 1)

	local x = math.round(offsetFromInstance.Position.X) + math.fmod(placeableBounds.Size.X/2, 1) - math.fmod(instance.Size.X/2, 1)
	local z = math.round(offsetFromInstance.Position.Z) + math.fmod(placeableBounds.Size.Z/2, 1) - math.fmod(instance.Size.Z/2, 1)

	local placeableCFrame = CFrame.new(x, y, z)

	return instance.CFrame:ToWorldSpace(placeableCFrame)
	
end

I have already tried using separate ray casts to determine the distance from the placeable to the ground but have simply gotten nowhere from there and gotten some pretty jittery results.