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

Repeat Until ignores what it needs to wait for?

Asked by 5 years ago
Edited 5 years ago

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.

0
until game.ReplicatedStorage.BAmount.Value -> should always return true as long as it exists Vulkarin 581 — 5y
0
So what you are saying is that I can't make it work with multiple values? It only works with one value? MineJulRBX 52 — 5y

2 answers

Log in to vote
1
Answered by
Lugical 425 Moderation Voter
5 years ago

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
Ad
Log in to vote
0
Answered by
Syclya 224 Moderation Voter
5 years ago

Use a .Changed event and check the value.

0
The value doesn't change unless I tell it to, and yes I have checked if it does. But it doesn't. MineJulRBX 52 — 5y

Answer this question