script.Parent.Touched:Connect(function(hit)
local character = hit.Parent
local human = character:FindFirstChild("Humanoid")
local player = game.Players:GetPlayerFromCharacter(character)
if player and human.Health > 0 then
human.Sit = true
end
end
✓ ANSWER ACCEPTED
does this code function correctly as a trap/deals damage?
2 answers
✓ Accepted answer
script.Parent.Touched:Connect(function(hit)
local character = hit.Parent
local human = character:FindFirstChild("Humanoid")
if human and human.Health > 0 then
human.Health -= damage
end
end
1 comment
0
thanks it works! :D
local sex = true
print(sex)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
What?
you don't need player, you could just use " If Human and Human.Health > 0 then Human.Health -= damage