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)
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)