I want to stop my idle animation whenever player unequipped the tool but i can’t make it.
local WeaponTool = script.Parent.Parent.Parent
local randomSlash = 1
local plr = game:GetService("Players").LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")
local EquipAnim = humanoid:LoadAnimation(script:WaitForChild("Equip"))
local IdleAnim = humanoid:LoadAnimation(script:WaitForChild("Idle"))
local Attack1Anim = humanoid:LoadAnimation(script:WaitForChild("Attack1"))
local Attack2Anim = humanoid:LoadAnimation(script:WaitForChild("Attack2"))
WeaponTool.Equipped:Connect(function()
game.ReplicatedStorage.ConnectM6D:FireServer(WeaponTool.PathmakerModel.BodyAttach)
char.Torso.ToolGrip.Part0 = char.Torso
char.Torso.ToolGrip.Part1 = WeaponTool.PathmakerModel.BodyAttach
script.Value.Value = true
if script.Value.Value == true then
EquipAnim:Play()
wait(0.5)
while true do
wait(0.01)
IdleAnim:Play()
if script.Parent.Parent.Parent.Unequipped then
IdleAnim:Stop() --Idle Anim here
break
end
end
end
end)