Why would you put
local lava = script.Parent
script.Parent.Touched:connect(function(hit)
if hit.Parent then
local guy = hit.Parent:FindFirstChild('Humanoid')
if guy then
guy.Health = 0
end
end)
Whats the point of the
if hit.Parent then
Why would you put
local lava = script.Parent
script.Parent.Touched:connect(function(hit)
if hit.Parent then
local guy = hit.Parent:FindFirstChild('Humanoid')
if guy then
guy.Health = 0
end
end)
Whats the point of the
if hit.Parent then
Sometimes a hit can have a nil parent, it's just a fail-safe to ensure it won't error if hit doesn't have a parent.
This discussion is preserved as it was. New answers, comments, and votes are closed.