Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I increase the value of a dev product with every purchase?

Asked by 5 years ago

I am wanting to create a script that allows players to purchase a dev prodcut, but every time they purchase it the price increases.

Example: The product may start at 100 Robux, and every time they purchase said product, 50 Robux will be added. So the second time they purchase the product it will cost 150 Robux, and so on.

Prompt Purchase Script

local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

local productID = 500068534

script.Parent.MouseButton1Click:Connect(function()
 local player = Players.LocalPlayer
 MarketplaceService:PromptProductPurchase(player, productID)
end)

Receipt Process Script

local MarketplaceService = game:GetService("MarketplaceService")
local Product = game.ServerStorage.GamepassItems.Product

MarketplaceService.ProcessReceipt = function(purchaseInfo)
local Plr = game:GetService("Players"):GetPlayerByUserId(purchaseInfo.PlayerId)

if purchaseInfo.ProductId == 500068534then
 local cloneProduct= Product:Clone()
 cloneProduct.Parent = Plr.Backpack
end

These are the script I am currently using. Hope this makes some form of sense.

0
There is no way to do so, all you could do is premake all the devproducts at a set price and have your code check which one to change the player with. benben3963 6 — 5y
0
There is a way, but you'd need to utilize httpsservice and your own server to make the changes on your account. Azarth 3141 — 5y

Answer this question