AlignPosition pets is not positioning pets correctly at all

I’m having issues where pets are going under ground at time. Can see here the AlignPosition goes underground for some reason
ezgif.com-gif-maker (73)
It also has wacky times where it just goes in the air for no reason
ezgif.com-gif-maker (74)
Unsure if I’m raycasting incorrectly

local PET_OFFSETS = {
	[1] = Vector3.new(0, 0, 5),
}

local Params = RaycastParams.new()
Params.FilterType = Enum.RaycastFilterType.Blacklist
Params.FilterDescendantsInstances = {
	workspace.ActivePets,
	workspace.OceanFloors,
	workspace.EggDebris,
	Player.Character
}
Params.IgnoreWater = true

-- done in a for loop, in this case, petIndex is 1
local PetPosition = (HumanoidCFrame * CFrame.new(PET_OFFSETS[petIndex])).Position

local RaycastResult = workspace:Raycast(
	PetPosition + Vector3.new(0, 15, 0),
	Vector3.new(0, -30, 0),
	Params
)

local NewPetPosition 
if RaycastResult then
	NewPetPosition = RaycastResult.Position
else
	NewPetPosition = PetPosition - Vector3.new(0, (Player.Character.Humanoid.HipHeight) + 1.5, 0)
end

local YOffset = -activePet.PetInstance.PrimaryPart.Floor.Position.Y + Pets[activePet.PetInstance.Name].AboveGroundY
local NewCFrame = CFrame.fromMatrix(NewPetPosition + Vector3.new(0, YOffset, 0), HumanoidCFrame.RightVector, HumanoidCFrame.UpVector)

activePet.PetInstance.PrimaryPart.AlignPosition.Position = NewCFrame.Position

AboveGroundY is almost set to -1.75