Holding animation still playing when I unequip my tool

Hello.
Just for fun, I tried to make a knife that remove holding animation and replace the running and idle animation. But whe I unequip the tool, then reequip it, the character doesn’t stop the holding animation, even if I equip/unequip it
Here is a video of what I mean (If you hear voices sorry)


I’m replacing the animate script with another to make custom anims

So the best way to make an animation Play on equipping:

First you gotta make sure that the animation is set on “Action” I don’t know about Moon Animator because I’m not an animator but anyway.

And also careful if the animation you made put to repeat mode.

Code:

local Player = game.Players.localPlayer -- Gets the player
local Tool = script.Parent -- Get the tool
local Character = Player.Character or Player.CharacterAdded:Wait() -- Gets the character
local Humanoid = Character:WaitForChild("Humanoid") -- Gets the humanoid
local Animation = instance.new("Animation") -- Create an animation
Animation.AnimationId = 1-- Put your animation id

local AnimationTrack = Humanoid:LoadAnimation(Animation)

tool.Equipped:Connect(function()
    Animation:Play()
end)
tool.Unequipped:Connect(function()
    Animation:Stop()
end)
1 Like

Hi !
Thanks for the comments but I don’t really need ^^<
I’m not tying to play animation when I equip a tool, since the tool replace the default roblox animation with another ones, Walk, Idle, and tool holding. Problem is that when I equip, the unequip the tool, it still play the equip tool animation.