I wanted to make a brick so when you are on it, it slowly damages you as long as you are on it. For example, you're head is in a water brick and you are supposed to drown, right? So you slowly lose 5 health until you die as long as your head is underwater. How can I do this? This is my script and it seems to not work.
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then
for i = 1, 2000 do
wait(1)
h.Health = h.Health - 5
end
end
end
script.Parent.Touched:connect(onTouched)

1 comment
This script does not seem to work, I tested it out and it only damages me once and stops. Is there supposed to be something that is missing?