So I Have A KillBrick Script When It Is Touched The Player Dies. What Is My Error If There Is? Sorry For The Title. The Title Filter Is Kinda Bad.
Script.Parent.Touched:Connect(Function(Hit) If (Hit ~= Nil) Then If (Hit.Parent) Then If (Hit.Parent:FindFirstChild("Humanoid")) ~= Nil Then Hit.Parent:FindFirstChild("Humanoid").Health = (0) End End End End)
was
There are several problems with capitalisation in your code. Case-sensitivity must always be taken into account or your code will have problems.
script.Parent.Touched:Connect(function(hit) if hit then if hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Humanoid.Health = 0 end end end)
I've tidied up your code a bit, but if you wanted to go slightly further you could do:
script.Parent.Touched:Connect(function(hit) local hum = hit.Parent:FindFirstChild("Humanoid") if hum then hum.Health = 0 end end)
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Humanoid.Health = 0 end end)