Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Dev Product Purchase Error. Anyone knows what's wrong here?

All purchases of dev products in my game are being failed. In studio they are working fine (no errors, etc.) Anyone knows what's the problem here?

code:
local MarketplaceService = game:GetService("MarketplaceService")

local Products = {
    [1151324899]=function(receipt,player)
        player.leaderstats.Gems.Value = player.leaderstats.Gems.Value + 1000
end;
    [1006268555]=function(receipt,player)
        player.leaderstats.Gems.Value = player.leaderstats.Gems.Value + 10000
    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

Error - https://gyazo.com/2659d12ffb7861855a73897b81870043

1 answer

Ahhhh. I have also encountered this error before. I don't know why it happens, but there is nothing wrong with your script. You have to create a new game and create new developer products for each product. Its really unconvenient, but it's the only solution i know of. If it still doesn't work, (It worked for me though) post this in bug reports on dev forum :)

If this has helped, please accept this as the answer :)

1 comment

0

I already tried but it's still not working. I will just post it on dev forum, thanks for help

This discussion is preserved as it was. New answers, comments, and votes are closed.