✓ Accepted answer
tool = script.Parent
tool.Equipped:Connect(function()
if not tool.Parent:isA("Backpack") then
local char = tool.Parent
local humanoid = char:FindFirstChild("Humanoid")
local animate = char:FindFirstChild("Animate")
if humanoid and animate and animate:FindFirstChild("idle") then
local idle1 = animate.idle:WaitForChild("Animation1")
local idle2 = animate.idle:WaitForChild("Animation2")
local default1 = idle1.AnimationId
local default2 = idle2.AnimationId
idle1.AnimationId = "http://www.roblox.com/Asset?ID=1776614601"
idle2.AnimationId = "http://www.roblox.com/Asset?ID=1776614601"
tool.Unequipped:Connect(function()
local ActiveTracks = humanoid:GetPlayingAnimationTracks()
for _,v in pairs(ActiveTracks) do
v:Stop()
end
idle1.AnimationId = default1
idle2.AnimationId = default2
end)
end
end
end)
7 comments
Is it a roblox character or custom character
The `layer
Is the script inside a tool
yes
look at answer and try that.
It works, but when I unequip the tool the animation continues running
try now