So i have two problems:
My character is supposed to heal 10 health per second, but instead he heals like 50 health per milisecond.
the healing lasts forever, no matter if i am touching the healing brick or not. the only way to stop it is to die.
heres the script:
function OnTouched (person) local i = person.Parent:FindFirstChild("Humanoid") if i ~= nil then while i ~= nil do wait(1) i.Health = i.Health + 10 end end end script.Parent.Touched:Connect(OnTouched)
add a debounce
local deb = true local active = true function OnTouched (person) if active = true then active = false if deb == true then deb = false local i = person.Parent:FindFirstChild("Humanoid") if i ~= nil then i.Health = i.Health + 10 end wait(1) deb = true end end end function touchended() active = true end script.Parent.Touched:Connect(OnTouched) script.Parent.TouchEnded:Connect(touchended)
i havent tested this , because im too lazy to , if someone can take over , ... ok