Help With Animations

Currently, I have a tool that changes the default animations whenever you equip it, however, if are running and then you equip the tool, it makes the player run with no animations, however, if I stop and then run again the animation then plays. How could I fix this?

Could u show us you’re script now please?

Make sure to set your animation Priority to Action

image

local function animationchanger()
	
	local humanoid = character:WaitForChild("Humanoid")

	for _, playingTracks in pairs(humanoid:GetPlayingAnimationTracks()) do
		playingTracks:Stop(0)
	end

	local animateScript = character:WaitForChild("Animate")
	animateScript.idle.Animation1.AnimationId = "rbxassetid://5955237072"
	animateScript.idle.Animation2.AnimationId = "rbxassetid://5955237072"
	animateScript.run.RunAnim.AnimationId = "rbxassetid://5955157531"
end

script.Parent.Equipped:Connect(function()
       animationchanger()
end