Here's the script:
wait()
function onTouched(part)
local h = part.Parent:FindFirstChild("Humanoid")
local anim = h:LoadAnimation(script.anim)
if h~=nil then
wait(.05)
h:TakeDamage(5)
anim:Play()
end
wait(1)
end
script.Parent.Touched:connect(onTouched)
The animation part doesn't work but without it the script works perfectly, have i done anything wrong?

1 comment
you dont need to check if "h" is nil