My Sword is supposed to do damage and play an animation. IT isn't doing either, but no error is playing. As you can see i added a print to just test it, and it is printing in output when i click.
I have two Scripts
This is a regular Script under the tool
script.Parent.blade.Touched:connect(function(p)
if script.Parent.CanDamage.Value == true then
if p.Parent:FindFirstChild("Humanoid") then
script.Parent.CanDamage.Value = false
p.Parent.Humanoid:TakeDamage(20)
wait(1)
script.Parent.CanDamage.Value = true
end
end
end)
This is a Local Script under the tool. There is an animation "Attack" under the Local Script.
local CanDamage = true
vPlayer = game.Players.LocalPlayer
character = vPlayer.Character
humanoid = character:FindFirstChild('Humanoid')
script.Parent.Activated:connect(function()
local Attack = humanoid:LoadAnimation(script.Attack)
if CanDamage == true then
print("hi")
Attack:Play()
CanDamage = false
wait(1)
Attack:Stop()
CanDamage = true
script.Parent.CanDamage.Value = true
end
end)
