Best way of changing animation based on the tool

I’m hoping this is the right topic for this.

I’m working on a small game and want to create different animations for various tools. For example, if I equip a sword, the character’s idle, walking, and other animations should change.

What’s the most effective way to achieve this? I’ve tried one method before where I simply copied the animation script and assigned different animations to each. Then, I used a script on the tool itself to enable one animation script and disable the other. However, I’m wondering if there’s a more efficient or organized approach.

Swap out the characters animations 2 ways

Either change the IDS in the animate script by setting them this way

Character.Animate.Idle = "Your ID"

Or by disabling the animate script and inside the tool, track when the characters state changes from walking to idle and play the corresponding animations.

So like, as soon the tool is equiped i change the id’s of every animation i want to change, right?

Yes, you can do this by hooking a function onto the Humanoid:ToolEquipped event.

Ok, ill try this method and let you know, thx for the answer

ok yeah it worked, tysm, you just saved me from a bunch of useless code and copypaste.

your welcome!

also if possible, could you mark me as the solution? I am trying to get my solutions up, and it helps others know that your problem is already solved.

sure, just quick question, wasn’t there a way to like update the player so it plays the animations instantly? rn the animations id’s updates but not the actual animation until i move and stop again (for the idle)

For idle, you can just load the animation to the player using Humanoid:LoadAnimation("rbxassetid://YourID") then play it!

oh ok, ill try it asap, again thx for the help.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.