Auto Equip Weapon

I already have an ‘equip sword’ function that plays the equip/unequip animation, but I need a way to ‘auto equip’ and skip the animation when I press the attack button. How do I do this?