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.
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)
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.)