Why does my dragon go under ground when I jump?

So whenever I jump my dragon just goes under the ground…

How would I fix this issue?

Script:

function DragonHandler:ConnectDragonToCharacter(player,Dragon,Slot,SlotPosition)
	local Character = player.Character or player.CharacterAdded:Wait()
	local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
	local PlayerDragons = player:WaitForChild("PlayerDragons")

	local DragonInfo = Dragon:WaitForChild("DragonInfo")

	local success, err = pcall(function()
		if Character:FindFirstChild(player.Name..Slot) then
			Character:FindFirstChild(player.Name..Slot):Destroy()
		end

		Dragon:SetPrimaryPartCFrame(HumanoidRootPart.CFrame)

		local BabyDragon = Dragon:WaitForChild("BabyDragon")

		local DragonStringValue = Instance.new("StringValue",PlayerDragons)
		DragonStringValue.Name = Dragon.Name
		
		local DragonNameSV = Instance.new("StringValue",DragonStringValue)
		DragonNameSV.Name = "DragonNameSV"
		
		local DragonLevelNV = Instance.new("NumberValue",DragonStringValue)
		DragonLevelNV.Name = "DragonlevelNV"
		
		local CharacterAttachA1 = Instance.new("Attachment",HumanoidRootPart)
		CharacterAttachA1.Name = "CharacterAttachA1"
		CharacterAttachA1.Orientation = Vector3.new(0,-180,90)

		local CharacterAttach2A2 = Instance.new("Attachment",HumanoidRootPart)
		CharacterAttach2A2.Name = "CharacterAttach2A2"
		CharacterAttach2A2.Orientation = Vector3.new(-0, 178, 90)

		local DragonAttachment = Dragon.PrimaryPart.HBA
		local DragonAlignPosition = Dragon.PrimaryPart.AlignPosition
		local DragonAlignOrientation = Dragon.PrimaryPart.AlignOrientation

		DragonAlignPosition.Attachment0 = DragonAttachment
		DragonAlignPosition.Attachment1 = CharacterAttachA1

		DragonAlignOrientation.Attachment0 = DragonAttachment
		DragonAlignOrientation.Attachment1 = CharacterAttach2A2

		Dragon.PrimaryPart.Position = HumanoidRootPart.Position + Vector3.new(0,2.5,0)

		Dragon.Parent = Character
		Dragon.Name = player.Name..Slot

		local DragonClone = script.Dragon:Clone()
		DragonClone.Parent = Dragon
		DragonClone.Disabled = false

		local DragonNameTag = Dragon.PrimaryPart:FindFirstChild("DragonNameTag")
		DragonNameTag.DragonLevel.Text = "Dragon Level: "..DragonInfo.DragonLevel.Value
		DragonNameTag.DragonName.Text = DragonInfo.DragonName.Value
		
		DragonHandler:CheckDragonAge(Dragon,SlotPosition,CharacterAttachA1,CharacterAttach2A2)
	end)

	if not success then
		warn(err)
	else
		print("Successfully connected dragon to player")
	end
end

Nothing really seems wrong with the script (at least from what I can tell from looking at it for like 5 minutes). I think this is more of a problem with the attachments.