when I pick it up it kills me and I don't know why, here is the code:
local Tool = script.Parent
while true do
Tool.Handle.Touched:Connect(function(hit)
if hit.Parent ~= Tool.Parent then
hit.Parent:WaitForChild("Humanoid")
hit.Parent.Humanoid:TakeDamage(5)
wait(1)
end
wait(0.1)
end)
wait(0.1)
end
When the tool is touched ( so either in your hand or I guess you hit someone with it ) it will damage that player.
if hit.Parent ~= Tool.Parent
that should in theory work, but if the player has an accessory like a necklace or an egg on their head, that if
will return true (since it's the player's necklace, not the player itself)
To fix that just add another check, like if hit.Parent~=Tool.Parent and hit.Parent.Parent~=Tool.Parent
this should work