Hello everyone, I'm trying to make it so that my script doesn't run all at once and wait() is not what I want. When I click, all of the script starts, is there any way to stop it once the variable toggle has changed?
01 | local button = script.Parent |
02 |
03 | local function click() |
04 | local toggle = 1 |
05 | if toggle = = 1 then |
06 | button.Font = Enum.Font.Arcade |
07 | toggle = 2 |
08 | end |
09 | if toggle = = 2 then |
10 | button.Font = Enum.Font.Highway |
11 | toggle = 3 |
12 | end |
13 | if toggle = = 3 then |
14 | button.Font = Enum.Font.Fantasy |
15 | toggle = 4 |
Thanks, any help would be appreciated
I know you said that you didn´t want any wait(). However, I am not sure that you have considered this. You could use a repeat until loop combined with wait() to stop your script from running until a certain condition is met.
01 | local button = script.Parent |
02 |
03 | local function click() |
04 | local toggle = 1 |
05 |
06 | repeat wait() |
07 | if toggle = = 1 then |
08 | button.Font = Enum.Font.Arcade |
09 | toggle = 2 |
10 | end |
11 |
12 | if toggle = = 2 then |
13 | button.Font = Enum.Font.Highway |
14 | toggle = 3 |
15 | end |
I could've just used elseif instead of multiple if statements.