How do I change idle, walk, jump, etc. animation when I equip a tool? And when I unequip it, the animations will be back to normal again

How do I change idle, walk, jump, etc. animation when I equip a tool? And when I unequip it, the animations will be back to normal again


script.Parent.Equipped:Connect(function()
	script.Parent.Parent.AnimateKat.Enabled = true --Enables the new animation
	script.Parent.Parent.Animate.Enabled = false -- Disables the current/old animation
end)

script.Parent.Unequipped:Connect(function()
	--Code that disables AnimateKat and enables Animate here
end)

Don’t use Animate scripts, load animations.

you shouldnt mess with the animate script that will cause the animations to glitch

use animation tracks and load them in when equipped through the humanoid’s animator

to make idle work the priority must be Action or above otherwise the animate script overwrites it

tool.Equipped:Connect(function()
    -- other animations
    idle = player.Character.Humanoid.Animator:LoadAnimation(tool.Animations.Idle)
    idle.Priority = Enum.AnimationPriority.Action
end)