How to do a buy max button?

    I don’t want to come off as begging for an example. I’m working on an app that’s plays similar to a game like Adventure Capitalist. I made a buy ten button that uses a for loop to calculate the cost of ten things. 

For example with the buy 10:

BuyTen = 10

for i=1, BuyTen do

    BuyTen = BuyTen - 1

    RestOfCode()

end

    I tried a repeat function to determine how many you can buy, but it was always off. I’m just wondering for ideas to do this better. 

What is "RestOfCode() doing with BuyTen?

In general, you probably should construct your for loop like:

for i = BuyTen, 1, -1 do     RestOfCode() -- uses the "i" variable end

Rob

What is "RestOfCode() doing with BuyTen?

In general, you probably should construct your for loop like:

for i = BuyTen, 1, -1 do     RestOfCode() -- uses the "i" variable end

Rob