Hello everyone! i was wondering if i could get some help with a function i want to create. Lost story short i have a currency system of 4 types and i want to remove one at a time depending on the amount i select. In current scenario i want to buy something and i have 2 gold, 3 silver and 1 copper coin. the amount is free to add so i want to get 3 times said item. what i would like is to iterate through the 2/3/1 coins and remove that amount in a descending order. so it would take the 2 gold + 1 silver leaving me with 0 gold / 2 silver and 1 copper!
Its not actually coins its an energy system that i want to have it as a combined amount. so if i wanted to give 5 amounts of said energy it would iterate through those amounts and remove them in descending order as it loops.