script.Parent.Touched:Connect(function(hit) if script.Parent:FindFirstChild("Humanoid") then script.Parent.Humanoid.Health = 0 end end)script.Parent.Touched:Connect(function(hit) if script.Parent:FindFirstChild("Humanoid") then script.Parent.Humanoid.Health = 0 end end)
script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then -- hit.Parent the thing that hits it the parent of it so the player then find humanoid in the player hit.Parent.Humanoid.Health = 0 -- same here end end)
You put script instead of hit.
script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Humanoid.Health = 0 end end)
Try this.
local damage = 100 --Default damage for lava based objects. script.Parent.Touched:Connect(function(object) if object.Parent:FindFirstChild("Humanoid") then hit.Parent.Humanoid:TakeDamage(damage)
this script will make it work!
function onTouched(hit) local human = hit.Parent:findFirstChild("Humanoid") if (human ~= nil) then human.Health = human.Health - 100 end end script.Parent.Touched:connect(onTouched)