How to make a cash shop, which updates the cash amount every time you purchase a item for a tycoon

Im sitting in my chair confused on How one can make the calculations for what im trying to make. I want to make something similar to Mall Tycoon. In the game when you purchase a item via the use of a Button, the Cash Shop updates to bigger amounts of cash you can buy, so if it starts off at 100 Cash for 80 Robux, its now 160 Cash for 80 Robux. I have a Purchases Folder where everything a player buys goes into the folder. Maybe I need to use this Folder as a way to calculate, but I have no clue how to do that.


Mall Tycoon Example

Any help would be appreciated!

2 Likes

So basically it would scale (multiply) with the amount of money the player currently has.

local robuxAmount = 80
local cashMultiplier = 1.5

-- Function to calculate new cash amount based on current cash
local function calculateNewCashAmount(player)
    local currentCash = player.leaderstats.Cash.Value 
    local newCashAmount = currentCash * cashMultiplier
    return newCashAmount
end


local function handlePurcahse(player)
    local PurchaseFolder = Instance.new("Folder")
    PurchaseFolder.Name = "Purchases"
    PurchaseFolder.Parent = player

    local RobuxPurchase = Instance.new("IntValue")
    RobuxPurchase.Name = "RobuxPurchase"
    RobuxPurchase.Value = robuxAmount

    local newCashAmount = calculateNewCashAmount(player)

    print("New Cash Amount: " .. newCashAmount)


end

script.Parent.MouseButton1Click:Connect(function()
    local player = game.Players.LocalPlayer
    handlePurcahse(player)
end)

Hope this helps, you wouldn’t do it exactly like this but i could help you understand how to do it

2 Likes

Multiple games do that, to ensure the player still has interest into buying cash from the shop even while having gazillions already.
Other games simply do the base amount of currency + 10% of player’s lifetime earnings. But of course, having your own formula to ensure interesting scaling is a better option than only providing 10% of scalable bonus.

2 Likes

Is there a way of using the Purchases folder that I’ve shown? Each time you buy something like a dropper or wall or anything with a button, the items go into that folder. Im wondrering if you could somehow use that folder to calculate the cash amount. Also how would i go about making bigger boosts for more expensive cash purchases? Like if 60 was like * 1.50 and the 2nd one could be double that at * 2.0 and each purchase amount updates like 2.50, 3.0 and lastly 3.50. First post on the devforum, so its hard for me to explain, thanks for the response!

Could you explain to me please?