local function A(A,n)while not A:FindFirstChild(n)do A.ChildAdded:wait()end return A[n]end local n=script.Parent local M={}local N local y local function S(A)if M[A]then M[A]:Play()end end local function Q(A)if M[A]then M[A]:Stop()end end function OnEquipped(Q)y=n.Parent N=A(y,"\072\117\109\097\110\111\105\100")if N then M.IdleAnim3=N:LoadAnimation(A(n,"\073\100\108\101\065\110\105\109\051"))M.IdleAnim3=N:LoadAnimation(A(n,"\073\100\108\101\065\110\105\109\051"))M.IdleAnim3=N:LoadAnimation(A(n,"\073\100\108\101\065\110\105\109\051"))M.IdleAnim3=N:LoadAnimation(A(n,"\073\100\108\101\065\110\105\109\051"))M.IdleAnim3=N:LoadAnimation(A(n,"\073\100\108\101\065\110\105\109\051"))M.IdleAnim3=N:LoadAnimation(A(n,"\073\100\108\101\065\110\105\109\051"))end S("\073\100\108\101\065\110\105\109\051")S("\073\100\108\101\065\110\105\109\051")end function OnUnequipped()for A,n in pairs(M)do Q(A)end end n.Equipped:connect(OnEquipped)n.Unequipped:connect(OnUnequipped);(A(n,"\080\108\097\121\073\100\108\101\065\110\105\109\051")).Changed:connect(function(A)S("\073\100\108\101\065\110\105\109\051")end);(A(n,"\080\108\097\121\073\100\108\101\065\110\105\109\051")).Changed:connect(function(A)S("\073\100\108\101\065\110\105\109\051")end);(A(n,"\080\108\097\121\073\100\108\101\065\110\105\109\051")).Changed:connect(function(A)S("\073\100\108\101\065\110\105\109\051")end)

local function WaitForChild(parent, childName)
	while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
	return parent[childName]
end

local Tool = script.Parent

local Animations = {}
local MyHumanoid
local MyCharacter


local function PlayAnimation(animationName)
	if Animations[animationName] then
		Animations[animationName]:Play()
	end
end

local function StopAnimation(animationName)
	if Animations[animationName] then
		Animations[animationName]:Stop()
	end
end


function OnEquipped(mouse)
	MyCharacter = Tool.Parent
	MyHumanoid = WaitForChild(MyCharacter, 'Humanoid')
	if MyHumanoid then
		Animations['IdleAnim3'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'IdleAnim3'))
		Animations['IdleAnim3'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'IdleAnim3'))
		Animations['IdleAnim3'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'IdleAnim3'))
		Animations['IdleAnim3'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'IdleAnim3'))
		Animations['IdleAnim3'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'IdleAnim3'))
		Animations['IdleAnim3'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'IdleAnim3'))
	end
	PlayAnimation('IdleAnim3')
	PlayAnimation('IdleAnim3')
end

function OnUnequipped()
	for animName, _ in pairs(Animations) do
		StopAnimation(animName)
	end
end

Tool.Equipped:connect(OnEquipped)
Tool.Unequipped:connect(OnUnequipped)

WaitForChild(Tool, 'PlayIdleAnim3').Changed:connect(
	function (value)
		--if value then
			PlayAnimation('IdleAnim3')
		--else
		--	StopAnimation('IdleAnim3')
		--end
	end)

WaitForChild(Tool, 'PlayIdleAnim3').Changed:connect(
	function (value)
		--if value then
			PlayAnimation('IdleAnim3')
		--else
		--	StopAnimation('IdleAnim3')
		--end
	end)

WaitForChild(Tool, 'PlayIdleAnim3').Changed:connect(
	function (value)
		--if value then
			PlayAnimation('IdleAnim3')
		--else
		--	StopAnimation('IdleAnim3')
		--end
	end)
