Hello, Im new at scripting and I need some help. So, I have a sword script and the damage works fine, but the animations... When I equip the sword the idle animation one hand does what have to do but the other stays default, after I click the attack animation works and my hands make idle animation normally. When I unequip the Sword my hands stuck in Idle animation. I also get an error: "Humanoid is not a valid member of Backpack" I also used this video to make the swords handle cause I dont have tool grip editor... https://www.youtube.com/watch?v=dRGEAethTGA
Script:
script.Parent.Blade.Touched:Connect(function(p) if script.Parent.CanDamage.Value == true then script.Parent.CanDamage.Value = false p.Parent.Humanoid:TakeDamage(20) end end)
LocalScript:
local canAttack = true script.Parent.Equipped:Connect(function() local idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle) idle:Play() end) script.Parent.Unequipped:Connect(function() local idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle) idle:Stop() end) script.Parent.Activated:Connect(function() local attack= script.Parent.Parent.Humanoid:LoadAnimation(script.Attack) local idle= script.Parent.Parent.Humanoid:LoadAnimation(script.Idle) if canAttack == true then attack:Play() idle:Stop() canAttack = false wait(1) attack:Stop() idle:Play() canAttack = true script.Parent.CanDamage.Value = true end end)