i have a sword i am trying to make
note: i have a bool value "CanDamage" which the value is set to false
local script:
local CanAttack = true
local idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle)
local attack = script.Parent.Parent.Humanoid:LoadAnimation(script.Attack)
script.Parent.Equipped:Connect(function()
idle:Play()
end)
local idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle)
local attack = script.Parent.Parent.Humanoid:LoadAnimation(script.Attack)
script.Parent.Activated:Connect(function()
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)
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)
the animation priorities are also right.
my sword wont play idle and attack animation, or attack, is something wrong in my script???

4 comments
Hi! Unfortunately the script didn't seem to make a difference :c All of a sudden my sword scripts just stopped working and i'm finding myself so frustrated.
Is there any error?
well the original script gives an error that humanoid isnt a member of tool, how do i find local players humanoid?
oh wait, then you need to add another parent, since you are searching humanoid in the tool but the tool is a child of a player and the humanoid is also a child of the player