I wanted to create a sword for a personal project. The intent was to have the sword swing when the player clicks. Lately I’ve been running into issues with animations. I created a swinging animation, but when the code tries to play the animation, the animation doesn’t play. I found a discussion page talking about a similar problem. The solutions proposed do not work however. In addition, after some testing, I discovered that the animation plays only if the tool is unequipped. Any fixes to this would be appreciated!
The code used to play the animation:
function PlayAnimation(Animation)
wait()
local NewAnimation = Instance.new("Animation")
NewAnimation.AnimationId = Animation.AnimationId
local AnimationTrack = Humanoid:LoadAnimation(NewAnimation)
AnimationTrack:Play()
end