Hey All,
I’m working on a shop script to buy/sale items and using math to show a total dollar and cent value. I can’t figure out how to make the final value of a sale to always show the two digits following a decimal points.
For example:
If an item costs .25 and the player buys 5 of them, the total shown is $1.25.
If the player buys 6 of the the total shown is $1.5
I’m trying to make the total read $1.50.
Basic example script:
local totalAmount = player.PlayerGui.ScreenGui.ShopFrame.TotalLabel --What will hold the final value
local item1 = .25 -- cost of each item
local quantity = player.PlayerGui.ScreenGui.ShopFrame.Quantity.Value -- quantity selected
totalAmount.Value = (item1 * quantity) -- assigns the final cost, but removes zeros at the end
Any thoughts on how to always show two places after the decimal point, even if they are zeros?