Problem with animation on tool equip and unequip

Hello everyone, I am trying to fix a bug where when the player equips a tool while walking, the tool’s custom idle animation would play instead of playing the custom walking animation until the player stops and starts walking again. Here is an example of the bug. Note that this only occurs ONCE while the tool is being equipped and the player is walking while the tool is being equipped.

Another problem is when the tool is unequipped the tool’s idle animation is still being played when the script has told it to stop.

Here are the tool equip and unequip functions that I am using:

function ToolEquip()

	Equipped = true
	CharacterAnimate.idle.Animation1.AnimationId = k.IdleAnim
	CharacterAnimate.walk.WalkAnim.AnimationId = BWAnim.AnimationId
							
	IdleAnimation = Humanoid:LoadAnimation(ToolIdleAnimation)
	IdleAnimation:Play()

end

function ToolUnequip()
							
	print("uEp")
							
	Equipped = false
	IdleAnimation:Stop()
	CharacterAnimate.idle.Animation1.AnimationId = BasicIdleAnimation.AnimationId
	CharacterAnimate.walk.WalkAnim.AnimationId = BasicWalkAnimation.AnimationId
							
end

THIS IS A LOCAL SCRIPT
CharacterAnimate is defined as the default Roblox “Animate” script
IdleAnimation is predefined as local IdleAnimation, allowing it to be used globally in the script
Everything else is defined properly with no errors and the print statement in the Unequip function is printing nicely.

My thoughts on the problem are that it is being caused by Roblox’s default “Animate” script not updating when new animations are introduced. Are there any work arounds for this?

(I tried searching up the problem on the dev forum but I couldn’t find anything from searching “Tool Animate”)

Another bug was found since the making of the post. The bug is directly affected by the bug above so fixing it should fix this one as well.

Here is the gif of the bug:
https://gyazo.com/f20c46bd7cb634ed07e45bd92f714ba6

The 1st part of the gif (first 3 seconds) is what the client sees, and the last 4 seconds is what the server sees. This bug ONLY occurs if the player equips the tool while walking. If the player equips the tool while standing still however, this bug does not appear.

1 Like

I was told that by a friend but I haven’t test it out yet. My only problem (in my head) is that if I have the legs unchecked, the idle animation will still play for the rest of the body parts and the custom walk animation is different from the idle animation. I’ll test it and let you know the results

I believe you have to load the animation into an AnimationController. You can’t just change the ID for it to work.

The animation is already being loaded into the humanoid (which is then loading it onto the Animator I believe) and changing it into the Character Animate is making sure that the old idle anim isn’t overriding it.

Currently my animation Priority is organised as such: Core - Idle Anims | Movement (Walk/Run) - Idle | Attacking Animations - Movement

Using Moon Animator, the circles were checked off and tested with the issue still persisting.

Delete all Legs keyframe in the Animation.

Like I said before, wouldn’t this result in the legs moving with the walk animation while the rest of the body still playing the idle animation? Also if we wanted to have the idle animation have a leg stance how would we enable that then?

1 Like