Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does this simple kill script not work?

Doesnt work... ._.

script.Parent.Touched:connect(function(hit)
	print(hit)
	hit.Parent.Humanoid.Health = 0
end)

1 answer

✓ Accepted answer

This will work, but only as long as the touched never errors.

A lot of contacts, though, would cause this to error.

Always include robust error checking in your code.

script.Parent.Touched:connect(function(hit)
	print(hit)
	if hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
		hit.Parent.Humanoid.Health = 0
	end
end)

1 comment

0

Thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.