So I only want my function to happen 4 times and I currently have a debounce which works fine but isn't there a way to shorten this?
My code:
debounce = true
times = 0
while debounce do
times = times + 1
if times <= 4 then
wait(5)
Attack()
else
debounce = false
end
end
Note: This code works fine, it's just I feel like theres an easier, shorter way to do this.

7 comments
THANK YOU!!!!
Does shortening your code make servers less laggy?
Probably not. Atleast I don't think so.
So I searched it up, it doesn't really change anything, but thanks for the help.
Also, I've seen for i,v in pairs a lot, does it do something similar?
https://scriptinghelpers.org/questions/11516/can-someone-explain-this-for-iv-in-pairs-to-me
Hope that explains it.