Im trying to make a animation play every time you equip a tool. It works when i equip it, but when i unequip it, the animation keeps on playing.
The error is: Humanoid is not a valid member of Backpack "Players.fireyfoxninja21.Backpack" - Server - Animation:17
Can anybody help figure out why this wont work?
(I used a normal script inside of a tool, with a handle.)
local Tool = script.Parent local Animation = Tool.Animation Tool.Equipped:Connect(function() local Player = Tool.Parent local Humanoid = Player.Humanoid local AnimationPlay= Humanoid:LoadAnimation(Animation) AnimationPlay:Play() end) Tool.Unequipped:Connect(function() local Player = Tool.Parent local Humanoid = Player.Humanoid local AnimationPlay = Humanoid:LoadAnimation(Animation) AnimationPlay:Stop() end)
youre gonna want to save the loaded animation to a variable which from you can then you :Play() and :Stop() on
also, Humanoid:LoadAnimation has been deprecated which means it shouldnt be used
use humanoid.Animator:LoadAnimation instead