i'm making a healing pad but it isn't working.
Here is my 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)
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.