The idle animation does not stop after the tool is unequipped.
This is what I have:
local Screen local Tool = script.Parent local EquipAnimation = script.Parent.Equip local UnequipAnimation = script.Parent.Unequip local IdleAnimation = script.Parent.Idle Tool.Equipped:Connect(function() local Humanoid = Tool.Parent.Humanoid local Track = Humanoid:LoadAnimation(EquipAnimation) Track:Play() if not game:GetService("Players").LocalPlayer.PlayerGui:FindFirstChild("ScreenGui") then wait(2) Screen = script.Parent.ScreenGui:Clone() Screen.Parent = game:GetService("Players").LocalPlayer.PlayerGui end local Trackidle = Humanoid:LoadAnimation(IdleAnimation) Trackidle:Play() end) Tool.Unequipped:Connect(function() Screen:Destroy() Trackidle:Stop() end)
You gotta initialize the IdleAnimation first, so you can play and pause it as you need:
local Screen local Tool = script.Parent local EquipAnimation = script.Parent.Equip local UnequipAnimation = script.Parent.Unequip local IdleAnimation = script.Parent.Idle -- I put the AnimationTracks at the top, this method is called "initialize" local Trackidle = Humanoid:LoadAnimation(IdleAnimation) local Track = Humanoid:LoadAnimation(EquipAnimation) Tool.Equipped:Connect(function() local Humanoid = Tool.Parent.Humanoid Track:Play() if not game:GetService("Players").LocalPlayer.PlayerGui:FindFirstChild("ScreenGui") then wait(2) Screen = script.Parent.ScreenGui:Clone() Screen.Parent = game:GetService("Players").LocalPlayer.PlayerGui end Trackidle:Play() end) Tool.Unequipped:Connect(function() Screen:Destroy() Trackidle:Stop() end)