I’m looking into making a Button Simulator Style game and I’m wonder how other would achieve making the buttons increase in price while also saving the price so when a player comes back to a server it will be the same price it was when they left.
i dont get what your trying to accomplish
What do you mean with “make the prices save to individual clients”? and i also dong get what do you are trying to accomplish
DataStores are the way to go when trying to save data.
So you wanna make it so you can buy upgrades that scale price? Well, you can just save the amount of times the player has bought the upgrade and maybe use multiplication to decide the price on the client. If that’s what you’re trying to do.
So basically when a player purchases an upgrade from a button the price will increase and once the player leaves the price will save so when they join back it’ll be the same price they left it
Instead of complicating yourself with the actual datastores, try this library: How to use DataStore2 - Data Store caching and data loss prevention
when u say button im assuming your talking about a ui button rather then a click detector
local DataStoreService = game:GetService("DataStoreService")
local UpgradeDataStore = DataStoreService:GetDataStore("Upgrades")
local function calculateMultiplier(value)
local baseMultiplier = 2
local exponent = 0.5
-- Calculate the dynamic multiplier
local dynamicMultiplier = baseMultiplier * math.log(value, 10)^exponent
return math.round(dynamicMultiplier)
end
game:GetService("MarketplaceService").PromptProductPurchaseFinished:Connect(function(userid, productId, isPurchased)
if not isPurchased then
return
end
if productId == 12345678 then
local Old = UpgradeDataStore:GetAsync(userid)
if Old then
local dynamicMultiplier = calculateMultiplier(Old)
UpgradeDataStore:SetAsync(userid, Old * dynamicMultiplier)
end
end
end)
i guess this then and just make it so when u click a button it prompts the product id