How to find the index inside an array which contains min value?

Thanks, ok that’s what I’m doing now.

The thing is if I have an ammo box with a quantity of 5 in the first slot and an ammo box with a quantity of 3 in the second slot it takes 1 away from the slot containing the lowest quantity which is great!

BUT if I have a box of 3 in the first slot and a box of 5 in the second slot, it will take 1 from the lowest quantity and once that slot (with a quantity of 3) is empty. the next time I loop it doesn’t then take away from the slot with the next lowest quantity (with the quantity of 5) because the index of the “Slot To Take From” doesn’t get updated for some odd reason. Do you have any ideas?