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

How can I put a debounce in my script so it only loops again when i is 1?

Asked by 5 years ago

Script:

while wait() do

    if Players.Value >= 2 then

        StatusBar.Text = "Waiting for round start"
        for i = 10, 1, -1 do
            Timer.Text = "Time:"..i
            wait(1) 
        end

    elseif Players.Value < 2 then
        StatusBar.Text = "There needs to be more than 1 player to begin the round."
    end
end

0
I don't get what you're trying to do here? Is the i to signify a countdown or? RyanTheLion911 195 — 5y
0
@Ryan, Its a basic for loop. I believe what he wants to do is set the minimum to a smaller number when i =1 EliteRayGawnX2 124 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

K so you would have to make a debounce variable. idk how else to explain, so ill just put comments in the script


local debounce=false--this is creating the variable while wait() do if debounce==false then-- making sure deb is false debounce=true--setting to true here if Players.Value >= 2 then StatusBar.Text = "Waiting for round start" for i = 10, 1, -1 do Timer.Text = "Time:"..i wait(1) else StatusBar.Text = "There needs to be more than 1 player to begin the round." end wait(0.15) debounce=false--resetting to false end end

tell me if it helped

Ad

Answer this question