I have a script when a tool is equipped two animations "idle" and "run" but when I unequip the tool the animation still plays, Any help?
local plr = game.Players.LocalPlayer
IdleAnim = script:WaitForChild("Idle")
RunAnim = script:WaitForChild("Run")
script.Parent.Equipped:Connect(function()
plr.Character.Humanoid.Running:Connect(function(value)
if value>0 then
playrun()
else
playidle()
end
end)
end)
script.Parent.Unequipped:Connect(function()
local run = plr.Character.Humanoid:LoadAnimation(RunAnim)
local idle = plr.Character.Humanoid:LoadAnimation(IdleAnim)
run:Stop()
idle:Stop()
end)
function playidle()
local run = plr.Character.Humanoid:LoadAnimation(RunAnim)
local idle = plr.Character.Humanoid:LoadAnimation(IdleAnim)
run:Stop()
idle:Play()
end
function playrun()
local run = plr.Character.Humanoid:LoadAnimation(RunAnim)
local idle = plr.Character.Humanoid:LoadAnimation(IdleAnim)
idle:Stop()
run:Play()
end

1 comment
Thank you very much!