I have a script under my tool, along with a bool value to correspond to help the blade only do damage when the tool is activated. Problem is that it will do damage and sometimes it won't and I can't find out why.
Problem here: https://gyazo.com/b326864ddd8a327f81d789d38e523534
Error code "13:57:57.606 - Players.Storche.Backpack.Scythe.Script:22: attempt to index nil with 'TakeDamage'" or "Humanoid is not a valid member of workspace."
local CD = true
--local color = false
script.Parent.DMG.Value = false
script.Parent.Activated:Connect(function()
if CD == true then
--if color == false then
--color = true
script.Parent.DMG.Value = true
--script.Parent.Damage.Transparency = 0.75
CD = false
wait (1)
--script.Parent.Damage.Transparency = 1
CD = true
--color = false
--end
end
end)
script.parent.Damage.Touched:Connect(function(p)
if script.Parent.DMG.Value == true then
script.Parent.DMG.Value = false
p.Parent:FindFirstChild("Humanoid"):TakeDamage(19)
wait(1)
end
end)
Error code is on line 22

1 comment
Idk why it auto indents like that either, but thank you.