To make everything clear, i don't want it to run just once. I want it to run non-stop while the player is touching the part and stop when he's not.
function onTouch(part)
local check = part.Parent:FindFirstChild("Humanoid")
while check ~= nil do
wait(1)
check.Parent.Humanoid.Health = check.Parent.Humanoid.Health - 1
end
end
script.Parent.Touched:connect(onTouch)

1 comment
use a if statement