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

How Can I Replicated "Or" Statements Using A Repeat-Until Statement?

Asked by 5 years ago

Whenever I say repeat wait() until foo or bar, the repeat keeps waiting until foo AND bar is true. Why is that, and how can I fix this?

1 answer

Log in to vote
0
Answered by
Kullaske 111
5 years ago
Edited 5 years ago

I believe this is an issue with your code. This example works as it should

local foo, bar

spawn(function()
    wait(math.random(1, 5))
    foo = true
    wait(math.random(1, 5))
    bar = true
end)

repeat print(foo, bar) wait() until foo or bar
print(foo, bar)

Output:

nil nil (x30) true nil

Ad

Answer this question