So. I’m trying to make a part that when player touched, the player will deal damage but I want it to have delay so that they could still walk on that part and not completely killing them. Script that I tried to use:
function onTouched(hit)
local human = hit.Parent:findFirstChild("Humanoid")
if (human ~= nil) then
while true do
wait(5)
human.Health = human.Health - math.random(20,30)
end
end
end
script.Parent.Touched:connect(onTouched)