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

Would this script work?

Asked by 10 years ago

Look at line 23 PurchaseHistory:IncrementAsync(PlayerProductKey, 1), would that fix/work?

I was told to remove Purchase History, did i fix it? If not please tell me with an example how i could.

local Service = Game:GetService("PointsService")

local Products={
    ["19715096"]=2,
    ["19715101"]=5,
    ["19715110"]=10,
    ["19715119"]=50,
    ["19715122"]=500
}

local PurchaseHistory = Game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")

Game:GetService("MarketplaceService").ProcessReceipt=function(Receipt)
    local PlayerProductKey = Receipt.PlayerId.."_"..Receipt.PurchaseId
    for _,Player in pairs(Game.Players:GetChildren())do
        if Player.userId==Receipt.PlayerId then
            if PurchaseHistory:GetAsync(PlayerProductKey)then
                return Enum.ProductPurchaseDecision.PurchaseGranted
            end
            for i, v in pairs(Products)do
                if tostring(Receipt.ProductId)==i then
                    Service:AwardPoints(Player.userId, v)
                    PurchaseHistory:IncrementAsync(PlayerProductKey, 1)--WOULD THAT WORK?
                    return Enum.ProductPurchaseDecision.PurchaseGranted
                end
            end
        end
    end
end

1 answer

Log in to vote
0
Answered by
Rukiryo 25
10 years ago

Buddy, You need to try it. We aren't here to do it for you. If it doesn't work, tell us. Try it first. And figure out where it's breaking.

You shouldn't be returning

Enum.ProductPurchaseDecision.PurchaseGranted

More than once. That makes no sense. I'm not sure you know what a return does or what your code does. And I don't exactly feel comfortable helping somebody make a "points store". That's a total scam of a game, for that reason I won't offer any more advice.

Ad

Answer this question