Part doesn't kill

I am trying to make it so whenever you touch the part, it kills you. Did i do something wrong?

local part = script.Parent
part.Touched:Connect(function(hit)
	local humanoid = hit.Parent:FindFirstChild("humanoid")
	if humanoid then
		humanoid.health = 0
	end
end)

Firstly you spelt Humanoid incorrectly.

You also misspelt Health.
Other than that there’s nothing wrong with the code

1 Like

I hate case sensitive properties.

Everything with the script is fine, however you just need to use capitalized letters for things like Humanoid and Health. Just change it to capital letters and you should be fine.

In Luau decided to abandon lowercase in many functions, so in particular everything starts with a capital letter, keep this in mind in the future.

local part = script.Parent

part.Touched:Connect(function(hit)
	local humanoid = hit.Parent:FindFirstChild("Humanoid")
	
	if humanoid then
		humanoid.Health = 0
	end
end)

mark as solution, other people are coming here thinking its not solved.