what happened was, i made a sword with animation and it was successful apart from the damage script, It keeps putting a error up that makes no sense and I cant unpatch it.
--Players.KOOLKILLER786.Backpack.ClassicSword.Damage:10: attempt to index local 'hum' (a nil value)--
--Script--
local CanAttack = script.Parent.CanAttack
script.Parent.Handle.Touched:Connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
if CanAttack.Value == true then wait()
CanAttack.Value = false
hum:TakeDamage(20)
end
end)
--
Please Help me
Hello
Maybe you should add
local CanAttack = script.Parent.CanAttack script.Parent.Handle.Touched:Connect(function(hit) local hum = hit.Parent:FindFirstChild("Humanoid") if hum ~= nil then if CanAttack.Value == true then wait() CanAttack.Value = false hum:TakeDamage(20) end end end)
"if hum ~= nil"
It will verify if the humanoid is there