I have a script that does damage but I don't know how to make a delay between doing damage.
Thanks.
I have a script that does damage but I don't know how to make a delay between doing damage.
Thanks.
Simply add something called a debounce, here's an tutorial on it: https://www.youtube.com/watch?v=HoZkuvd6RPA
Just use a wait statement...
wait(2)
How many seconds you want it to wait in between.
just add a debounce, like one of the replies mentioned. debounces are for a block of code not to run in a certain amount of time. in your case you could do something like this:
debounce = false -- first we create a variable called debounce and set it to false
function damage()
if not debounce then -- the code inside this block will only be executed if there's no cooldown (debounce is set to fall)
debounce = true -- sets debounce to true
-- do all the stuff you want here
wait(1) -- cooldown
debounce = false -- sets debounce to false
end
end
feel free to clear any doubt about this
This discussion is preserved as it was. New answers, comments, and votes are closed.