Why isn't my animation not playing?

  1. What do you want to achieve?
    Play animation on equipped event.
  2. What solutions have you tried so far?
    I don’t think there are any solutions since I cannot see a single wrong thing in the local script.

The local script:

local plr = game.Players.LocalPlayer
repeat wait()
	
until plr.Character
local char = plr.Character
local h = char:FindFirstChild("Humanoid") -- I also tried WaitForChild(), doesn't work.
local equipped = false
local IdleTrack = h:LoadAnimation(script.Parent.Idle)


--
script.Parent.Equipped:Connect(function()
	equipped = true
	h.Running:Connect(function(speed)
		if equipped == true then
			if speed == 0 then
				IdleTrack:Play()
			else
				IdleTrack:Stop()
			end
		end
	end)
end)
--
script.Parent.Unequipped:Connect(function()
	equipped = false
	IdleTrack:Stop()
end)
--
  1. What is the issue?
    The animation won’t play.

I fixed it by setting the anim to action but now my character can’t jump.