so im trying to create a part that when the player enters it does damage at a constant speed for an example im trying to do 25 damage every 5 seconds although it dosnt do 1 ever 5 it tries to squeeze in as meany times as possible in the time its active, heres my script
local Debounce = false
local function onTouch(hit)
Debounce = true
print(hit.Parent)
hit.Parent.Humanoid:TakeDamage(25)
wait(5)
Debounce = false
end
script.Parent.Touched:connect(onTouch)
I merged two scripts that I found on YT together and this works but not in its intended way for any who does help; Thanks ;)

5 comments
I tried it and I also tried messing around with it and it just seems to break the script
eh no, why would it break the script? e.e thats just how you use debounce, its most likely your "messing around" that breaks it, post what you have written now
im currently using the one you sent, my messing around was just moving things like the print(hit.Parent) to see if the local function still worked (which it did)
i updated the code a bit, try it again, also were there any error?
yeah thanks its working now but at first it didn't come up with an error