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

[SOLVED] How do I keep developer products from repeating on entry?

Asked by 9 years ago

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!

1 answer

Log in to vote
0
Answered by
yumtaste 476 Moderation Voter
9 years ago

You probably have a DataStore script somewhere in your game place which saves purchases. If you can find it, please post it, and I can help you further.

0
The closest thing to that is the script that saves your total cash. I don't have a purchase save script. ChipioIndustries 454 — 9y
0
That's what I meant. Please upvote. I could really use the rep. :D yumtaste 476 — 9y
Ad

Answer this question