Animation Script

Why is this tool animation script not working? This is a local script inside of my tool, and I also have my animation inside of it.
image

local player = game:GetService("Players").LocalPlayer
local character = player.Character
local animation = script.Parent:FindFirstChild("Animation")
local swingAnimation = character.Humanoid:LoadAnimation(animation)
local Tool = script.Parent

local canSwing = true

local debounce = 1

script.Parent.Activated:Connect(function()
	if canSwing then
		canSwing = false
		swingAnimation:Play()
		
		wait(debounce)
		canSwing = true
	end
end)

It might be because of an update regarding the humanoid animation system, read here:

The deprecation of these functions shouldn’t affect legacy scripts. As to OP: make sure you’re not getting any errors in the console and make sure you aren’t calling any nil values such as the character when it isn’t loaded (I’m not sure if this is the case with tools and localscripts, but watch out for it.)

1 Like

Check what Animation Priority the animation is and make sure it is set to Action.

1 Like

Yes you are correct. But I solved this already. Thanks!