Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 4 years ago
Edited 4 years ago

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

Log in to vote
1
Answered by 4 years ago

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
Ad

Answer this question