So I have my own thing like this and it can do multiple.
---Script goes in ServerScriptService---
local MarketplaceService = game:GetService("MarketplaceService")
local Products = {
[0]=function(receipt,player)
player.leaderstats.Cash.Value = player.leaderstats.coin.Value +10
end;
[0]=function(receipt,player)
player.leaderstats.Cash.Value = player.leaderstats.coin.Value +25
end;
[0]=function(receipt,player)
player.leaderstats.Cash.Value = player.leaderstats.coin.Value +40
end;
[0]=function(receipt,player)
player.leaderstats.Cash.Value = player.leaderstats.coin.Value +60
end;
[0]=function(receipt,player)
player.leaderstats.Cash.Value = player.leaderstats.coin.Value +400
end;
[0]=function(receipt,player)
player.leaderstats.Cash.Value = player.leaderstats.coin.Value +1000
end;
[0]=function(receipt,player)
player.leaderstats.Cash.Value = player.leaderstats.coin.Value +10000
end;
[0]=function(receipt,player)
player.leaderstats.Cash.Value = player.leaderstats.coin.Value +50000
end;
}
function MarketplaceService.ProcessReceipt(receiptinfo)
local playerProductKey = receiptinfo.PlayerId..":"..receiptinfo.PurchaseId
local plr = game:GetService("Players"):GetPlayerByUserId(receiptinfo.PlayerId)
local handler
for ProductId,func in pairs(Products) do
if ProductId == receiptinfo.ProductId then
handler = func break
end
end
local suc = pcall(handler,receiptinfo,plr)
return Enum.ProductPurchaseDecision.PurchaseGranted
end
---Script for the Gui Button---
script.Parent.MouseButton1Click:Connect(function()
game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer,0)
end)
4 comments
Could you show a bit more code?
thats all i have
my cash is in the player, and the cash is caled coins
Just posted a answer hope it helped