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.
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.