1 | script.Parent.Touched:Connect( function (hit) |
2 | if script.Parent:FindFirstChild( "Humanoid" ) then |
3 | script.Parent.Humanoid.Health = 0 |
4 | end |
5 | end )script.Parent.Touched:Connect( function (hit) |
6 | if script.Parent:FindFirstChild( "Humanoid" ) then |
7 | script.Parent.Humanoid.Health = 0 |
8 | end |
9 | end ) |
1 | script.Parent.Touched:Connect( function (hit) |
2 | 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 |
3 | hit.Parent.Humanoid.Health = 0 -- same here |
4 | end |
5 | end ) |
You put script instead of hit.
1 | script.Parent.Touched:Connect( function (hit) |
2 | if hit.Parent:FindFirstChild( "Humanoid" ) then |
3 | hit.Parent.Humanoid.Health = 0 |
4 | end |
5 | end ) |
Try this.
1 | local damage = 100 --Default damage for lava based objects. |
2 | script.Parent.Touched:Connect( function (object) |
3 | if object.Parent:FindFirstChild( "Humanoid" ) then |
4 | 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)