I made a small fun obby game and i added a KillBrick, I then added a KillScript to it but when i tested it, It didnt work and gave me some errors.
script.Parent.Touched:connect(function(hit)
if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid.health = 0
end
end)
Minor side note, but connect is deprecated, it’s a small change but do consider changing it to Connect
Lua is case-sensitive, so you have to specify the properties you want to change
script.Parent.Touched:Connect(function(hit)
if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid.Health = 0
end
end)
health as the error states, is not a valid member, howeverHealth is
script.Parent.Touched:Connect(function(hit)
if hit and hit.Parent and hit.Parent:FindFirstChild(“Humanoid”) then
hit.Parent.Humanoid.Health = 0
end
end)