Edit: I forgot to tell the server that the purchase had been processed. I created a developer product that allows you to purchase more credits, but then, if you leave and rejoin, you get the same amount of credits again. Does anyone know how to fix this?
Here is the script:
local mps=game:GetService("MarketplaceService")
function getPlayerFromID(id)
local plrs=game.Players:GetPlayers()
for i=1,#plrs do
if plrs[i].userId==id then
return plrs[i]
end
end
end
mps.ProcessReceipt=function(info)
if info.ProductId==22821479 then
local plr=getPlayerFromID(info.PlayerId)
plr.leaderstats.Cash.Value=plr.leaderstats.Cash.Value+1000
elseif info.ProductId==22821510 then
local plr=getPlayerFromID(info.PlayerId)
plr.leaderstats.Cash.Value=plr.leaderstats.Cash.Value+2500
elseif info.ProductId==22821535 then
local plr=getPlayerFromID(info.PlayerId)
plr.leaderstats.Cash.Value=plr.leaderstats.Cash.Value+5000
elseif info.ProductId==22821547 then
local plr=getPlayerFromID(info.PlayerId)
plr.leaderstats.Cash.Value=plr.leaderstats.Cash.Value+10000
end
end
If you can help me, that'd be great!

2 comments
The closest thing to that is the script that saves your total cash. I don't have a purchase save script.
That's what I meant. Please upvote. I could really use the rep. :D