When you click it does play the animation, but it is supposed to deal damage as well.
Why isn't it? Am I not using the Touch Event correctly?
No errors btw
No errors btw
Player = game.Players.LocalPlayer
local tool = script.Parent
playing = true
tool.Equipped:connect(function(Mouse)
Mouse.Button1Down:connect(function()
if playing then
playing = false
print("Sword Hit")
local animaya = Instance.new("Animation")
animaya.Parent = script.Parent
animaya.AnimationId = "http://www.roblox.com/asset?id=476333585"
local animat = Player.Character.Humanoid.Animator:LoadAnimation(animaya)
animat:Play()
wait(1.4)
playing = true
end
end)
end)
playing = true
function onTouched(hit)
if playing then
playing = false
local hum = hit.Parent:findFirstChild("Humanoid")
if (hum ~= nil) then
hum.Health = hum.Health - 8
wait(0.8)
playing = true
end
end
end
game.StarterPack.Sword.Handle.Touched:connect(onTouched)

1 comment
You forgot to comment "No errors btw". That might be what causes your script to fail.