Stop playing Idle Animation

Hello,
I wanted to know how to stop a playing idle animation for a tool.
The animation loads and works perfectly fine but after unequipping the tool it is still active so the character is doing the animation without the specific tool.

local Tool = script.Parent
local Player = game.Players.LocalPlayer
local Char = game.Workspace:WaitForChild(Player.Name)
local Humanoid = Char:WaitForChild("Humanoid")

Tool.Equipped:Connect(function()
	Humanoid:LoadAnimation(script.LongIdle):Play()
end)

Tool.Unequipped:Connect(function()
	Humanoid:LoadAnimation(script.LongIdle):Stop()
end)

Here

local Tool = script.Parent

local Player = game.Players.LocalPlayer

local Char = game.Workspace:WaitForChild(Player.Name)
local Humanoid = Char:WaitForChild("Humanoid")

local Idle = Humanoid:LoadAnimation(script:WaitForChild("LongIdle", 100))

Tool.Equipped:Connect(function()
	Idle:Play()
end)

Tool.Unequipped:Connect(function()
	Idle:Stop()
end)
2 Likes

Thanks for the quick reply ^^
It works fine now.
Just one question…
What does the 100 in local Idle stand for?

100 is a second for timeout if instance is not found.

1 Like