Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

does this code function correctly as a trap/deals damage?

Asked by 2 years ago
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
1
What? AronYstad 101 — 2y
0
you don't need player, you could just use " If Human and Human.Health > 0 then Human.Health -= damage gymsharklife1 54 — 2y

2 answers

Log in to vote
2
Answered by 2 years ago
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

0
thanks it works! :D badimo3456p 114 — 2y
Ad
Log in to vote
0
Answered by 2 years ago
local sex = true
print(sex)

Answer this question