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

[SOLVED] How would you make a timed door that opens and closes at a certain amount of time?

So, I want to make a door that stays open for a certain amount of time (meaning the door would open when a player stands in front of it) and close after a while, for a certain amount of time before becoming open again (meaning the door would stay closed even if the player stands in front of it). Can you please explain the concept behind how to do this? I want to script it myself.

1 answer

✓ Accepted answer

I believe that you are saying about Debounce, it prevents spamming. Here is how you do it

local Debounce = false
local function randomfunction()
	if not Debounce then
		Debounce = true -- now the script will stop working cause Debounce is true
		wait(2)
		Debounce = false
end

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