This is a very simple script that is supposed to stop an animation when I unequipped a tool. T
script.Parent.Unequipped:connect(function() local idle = script.Parent.Parent.Humanoid:LoadAnimation (script.Idle) idle:Stop() end)
It give me an error "Humanoid is not a valid member of backpack". If thats true, then why does this work?
script.Parent.Equipped:connect(function() local idle = script.Parent.Parent.Humanoid:LoadAnimation (script.Idle) idle:Play() end)
If you can help, that would be much appreciated.
Once the tool is unequipped , it's moved to the Backpack, so you cannot use script.Parent.Parent to get the character (which you shouldn't be doing anyways)
local plr = game:GetService("Players").LocalPlayer script.Parent.Unequipped:connect(function() local idle = plr.Character.Humanoid:LoadAnimation (script.Idle) idle:Stop() end)