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

Repeat Until ignores what it needs to wait for?

This line where it needs to wait until one of these 2 values are 0 or below. But it only runs the loop ones and completely ignores the part of what it needs to wait for.

repeat wait() until game.ReplicatedStorage.BAmount.Value or game.ReplicatedStorage.RAmount.Value <= 0

The values are 1 or above, but it ignores the until part and just do wait() a single time.

2 comments

0

until game.ReplicatedStorage.BAmount.Value -> should always return true as long as it exists

0

So what you are saying is that I can't make it work with multiple values? It only works with one value?

2 answers

✓ Accepted answer

Your issue is rather a simple one, but a great example of syntax in Lua. You see, when you’re waiting for both of the values to be below 0, you should refer to each value in the until statement <= 0. The second value in your ending statement has already done that, but the BAmount value doesn’t have that little string in front of it. As you left it like how it is now, the game is going to assume that BAmount is a bool value (which is true/false) rather than a number value. Hopefully this isn’t too confusing, but all in all, make sure to say the <= 0 clause to each value in the until statementfor proper Lua syntax.

repeat 
    wait()
until game.ReplicatedStorage.BAmount.Value <= 0 or 
game.ReplicatedStorage.RAmount <=0

Use a .Changed event and check the value.

1 comment

0

The value doesn't change unless I tell it to, and yes I have checked if it does. But it doesn't.

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