✓ Accepted answer
#Debounces
debounces aren't some hidden functionality that come along with functions. Merely stating debounce = false and debounce = true gives the compiler no information whatsoever about preventing the function from running at all.
The variable name debounce does not trigger any extra functionality. It is a variable just like all else. The whole point of a debounce is to set some form of regulation (a conditional in our case) that will tell the function to act or not act based on the current value of the debounce.
To clarify with code:
DigitalVeerLovesSteampunk = false;
script.Parent.Touched:connect(function(hit)
if not DigitalVeerLovesSteampunk then
DigitalVeerLovesSteampunk = true;
print("Hello!")
wait(2)
DigitalVeerLovesSteampunk = false;
end
end)
As you can see, we basically check if the debounce (in our case it is DigitalVeerLovesSteampunk) is a certain value. If it is, run the function. If not, don't do anything. This is how debounces work. They aren't any special lua-designed functions. It's merely just a check-and-peck.