Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is "local db" another way to Define Debounce?

2 answers

✓ Accepted answer

Debounce is a design pattern. The name debounce doesn't mean anything special to Lua, and really, you should be using a better name than that.

I prefer the name enabled. Before proceeding, you always check that you are enabled. You can choose to disable yourself by setting enabled to false.

Code looks like this:

local enabled = true -- start on

function doThing()
	if enabled then
		-- I'm allowed to work
		enabled = false -- but I'm temporarily disabled while I work
		-- (do stuff)
		wait(5)
		enabled = true -- I'm available to work again
	end
end

Debounce is a variable, meaning that, it can be named whatever you want. I guess a person that at least understands a bit a variables would know this.

This discussion is preserved as it was. New answers, comments, and votes are closed.