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.