Pets Following Player but Not Animating

I want the pets that are following my player around to be animated with a little โ€œhopโ€ when moving, similar to Pet Simulator x/99.

I have set all pets up correctly to be animated, but the animations are not playing when the pet is moving.

Here is the part of code that handles that:

humanoid.WalkSpeed = 10

	-- ๐Ÿงช Debug
	print("Children of petModel:", petModel:GetChildren())

	-- ๐Ÿ”„ Walking animation setup
	if petModel:FindFirstChild("Walks") then
		print("โœ… Walks tag found โ†’ Setting up animation")

		local animator = humanoid:FindFirstChildOfClass("Animator")
		if not animator then
			animator = Instance.new("Animator")
			animator.Name = "Animator"
			animator.Parent = humanoid
			print("๐Ÿงฑ Animator created and parented to humanoid")
		end

		local walkAnim = Instance.new("Animation")
		walkAnim.AnimationId = "rbxassetid://109577155834640" -- Replace this!
		walkAnim.Parent = petModel
		local walkTrack = animator:LoadAnimation(walkAnim)
		walkTrack.Priority = Enum.AnimationPriority.Movement
		-- Optional: ensure humanoid can animate
		humanoid:ChangeState(Enum.HumanoidStateType.Running)

		local lastPos = petModel.PrimaryPart.Position

		game:GetService("RunService").Heartbeat:Connect(function()
			if not petModel:IsDescendantOf(character) then return end

			local currentPos = petModel.PrimaryPart.Position
			local distance = (currentPos - lastPos).Magnitude

			if distance > 0.05 then
				if not walkTrack.IsPlaying then
					walkTrack:Play()
				end
			else
				if walkTrack.IsPlaying then
					walkTrack:Stop()
				end
			end

			lastPos = currentPos
		end)
	end
end

Iโ€™ve tried a few variations of the code but nothing seems to get them animated