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

What's wrong with my dev product script?

Asked by 10 years ago
MarketplaceService.ProcessReceipt = function(receiptInfo)
    player2 = receiptInfo.PlayerId
    pass = receiptInfo.ProductId
    key = "user_" .. player2
    if pass == 20308338 then
        print("Key is " .. key)
        DS:UpdateAsync(key, function(oldValue)
            print("Trying to update")
            if oldValue == 1 then
                newValue = 2
                print("Set to 2")
            else
                print("Set to 3")
                newValue = 3
            end 
            print("returning " .. newValue)
            return newValue
        end)
        print("Done!")
        return Enum.ProductPurchaseDecision.PurchaseGranted     
    end 
    if pass == 20410780 then
        print("Well, the pass is right")
        if #playersAlive > 0 then
            print("enough players")
            pt = playersAlive[1]
        end
        if pt and pt.Character then
            print("joining")
            join(player2,pt.Character.Torso.Position)
            return Enum.ProductPurchaseDecision.PurchaseGranted     
        else
            player2.leaderstats.Points.Value = player2.leaderstats.Points.Value + 70
        end 
    end
    if pass == 20308373 then
        print("Key is " .. key)
        DS:UpdateAsync(key, function(oldValue)
            print("Trying to update")
            if oldValue == 3 then
                newValue = 4
                print("Set to 4")
            else
                print("Set to 1")
                newValue = 1
            end 
            print("returning " .. newValue)
            return newValue
        end)
        print("Done!")
        return Enum.ProductPurchaseDecision.PurchaseGranted     
    end 
end


jong = game.Workspace.jong
game.Workspace.jong.Changed:connect(function()
    playher = game.Players:FindFirstChild(jong.Value)
    if playher then
        if not checkTable(playersAlive,playher) and script.gameRunning.Value == 2 and #playersAlive > 0 then -- MAKE 1
            MarketplaceService:PromptProductPurchase(playher, 20410780)
            jong.Value = "NA"
        end 
    end 
end)

Here is the script, for some reason the entire receipt part never fires! The purchase is prompted but wont fire the receipt and therefore wont reward the player!

Answer this question