It's not working because your character have full health , this is why don't appear a error message on output.
To solve this problem, I created a block that when touched by the character, it loses life (leaves the character with 1 life always).
script.Parent.Touched:Connect(function(hit)
local h = hit.Parent:FindFirstChild("Humanoid")
if h ~= nil and h.Health > 1 then
h.Health = h.Health - 1
end
end)
And another block with your script :
local db = false
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') then
if db == false then
db = true
if hit.Parent.Humanoid.Health < 100 then
hit.Parent.Humanoid.Health = 100
wait(2)
db = false
end
end
end
end)
first lose life in the first block and then go to the other, it will heal the character completely.
2 comments
Your script is correct, but the pad that delete 1 health is not the best way to do it. Because a normal people have a script that heal 1 health every second, so next time use :GetDamage(50) instead! c:
Okay :)