script.Parent.Activated:Connect(function()
Swing = script.Parent.Parent.Humanoid:WaitForChild("Animator"):LoadAnimation(script.Parent.Handle.Swing)
script.Parent.Parent.Humanoid.Walkspeed = 0
-- sets walkspeed to 0 to allow the anim to play without disturbance
Swing:Play()
wait(2.3)
script.Parent.Parent.Humanoid.WalkSpeed = 16
-- sets walkspeed back after anim duration
end)
script.Parent.Unequipped:Connect(function()
Swing:Stop()
script.Parent.Parent.Humanoid.WalkSpeed = 16
-- if the player decides to unequip the tool for whatever reason, speed is restored and anim is stopped
end)
the script is a server script, placed under the tool
if you need more info please request it in the replies
And also a small hack for you wait(Swing.Length)
This gets the length of how long the animation is in seconds, so you don’t have to always change you wait if you change your animation.