Click To Animate Script Not Working (SCRIPT BY "Lightning TNT")

Hello, this script is from “Lightning TNT” on YouTube, and it keeps saying

 Anim is not a valid member of LocalScript "Players.Pro_atgamesA.Backpack.SledgeHammer.LocalScript"  -  Client - LocalScript:2

Script:

 local plr = game:GetService("Players").LocalPlayer
local anims = {script.Anim
}
local loadedAnims = {}
local tool = script.Parent
local animator
local debounce = true
local del = 1 --The cooldown between each click

--Connections:


--Click animation:
tool.Activated:Connect(function()
	if(debounce) then --Setting up the debounce (cooldown)
		debounce = false
		animator = plr.Character:WaitForChild("Humanoid"):WaitForChild("Animator") --Find the animator object
		if(not loadedAnims[2]) then --If the animation didn't exist yet
			loadedAnims[2] = animator:LoadAnimation(anims[2]) --Load it
		end
		loadedAnims[2]:Play() --Play it

		wait(del) --Wait the cooldown
		debounce = true
	end
end)

tool.Unequipped:Connect(function()
	if(loadedAnims[2]) then --If the click animation was loaded
		loadedAnims[2]:Stop() --Stop it once the tool is unequipped
	end
end)


Error in Output:

 Anim is not a valid member of LocalScript "Players.Pro_atgamesA.Backpack.SledgeHammer.LocalScript"  -  Client - LocalScript:2

Do you all know what is going on?

Edit: Animation Priority is set to Action.

did you put the animation into the tool? it looks like it isn’t detecting the animation

local anims = script:WaitForChild("Anim")

you can try this if you have an animation in the tool for line 2

1 Like