Help With Raycasting [Raycast Fails And Works Randomly]

Hey, Thanks for clicking on This Post.
I Created this Post since I Need Help With Raycasting.

The Pets Randomly Fall Down And in the Output it Prints : raycast_failed.
The Pets then Randomly Again Come back Up with the Character.

Here is A Video :-


Here is My Script For the Raycast

local function GetPositionY(pos,character,pet_container)
	-- Pet_container is a folder which has all the pets of the player
	-- pos is the Position of the PetModel (We Use it for X and Y Axis)
	-- Character is the Player's character
	local Paramas = RaycastParams.new()
	Paramas.FilterDescendantsInstances = {pet_container:GetDescendants(),character}
	Paramas.FilterType = Enum.RaycastFilterType.Blacklist
	Paramas.IgnoreWater = true

	local returning_number = character.HumanoidRootPart.Position.Y
	local raycastResult = workspace:Raycast(pos + Vector3.new(0,character.Head.Position.Y + 10,0), Vector3.new(0,-100,0), Paramas)
	if raycastResult then
		returning_number = raycastResult.Position.Y
	else
		print('raycast_failed')
	end		
	return returning_number
end

I’m trying to figure this out for the previous hour,
All help is appriciated!

Nvm, Found the solution myself.
All i had to do was Anchor the Pet’s PrimaryPart.

Sorry for the Inconvenience!