So I was able to get the weapon animations to work but whenever I remove the weapon the animation stays in place. I'm not sure how I can stop the animation when the weapon is unequipped. Here is the script
local plr = game:GetService("Players").LocalPlayer local char = plr.Character or plr.CharacterAdded:Wait() local h = char:WaitForChild("Humanoid") local anim = h:LoadAnimation(script.Parent:WaitForChild("Animation")) local tool = script.Parent tool.Equipped:Connect(function() anim:Play() end)
You need to use the Unequipped
event to do this. Pretty similar to what you have in the Equipped event but instead use unequipped and have the line: anim:Stop()
.
This one is pretty self-explanatory. Use a .Unequipped event.
Tool.Unequipped:Connect(function() anim:Stop() end)