Animation Will not stop

Can’t tell if this is a bug or not



wait(1)
local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()


local wear = false

enabled = true

local h = char:WaitForChild("Humanoid")


local Tool = script.Parent

local p1 = char

local anim3 = h:LoadAnimation(script.Parent:WaitForChild("Animation3"))	

local cd = false

function onActivated()


if not enabled  then
	return
end
local Humanoid = Tool.Parent:FindFirstChild("Humanoid")

if wear == false then
		anim3:Stop()
	wear = true
	wait(.9)

	wait(.2)


	wait(.1)

	wait(1)

else



	wait(1.2)

	wait(.2)

	wait(.3)

	wait(1)
wear = false

end
end




Tool.Equipped:Connect(function()
	anim3:Play()
	--anim:Play()
end)

Tool.Unequipped:Connect(function()
	anim3:Stop()
end)

so anim3 plays as an idle, the first time i activate the tool, its supposed to stop the idle, because i put on the mask, the second time i activate it, it takes off the mask and is supposed to start the idle back up, unfortunately the idle dosen’t seem to want to stop when I tell it to on line
32

Any help would be great

The equip mask animations are located in the server script, While the idles are located in the local script as you can see above

Everything else works perfectly