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

Dev product not working? [HELP PLEASE!]

Asked by 8 years ago

Hi guys! I have been trying to fix this for 2/3 weeks now and I still cannot get it work! It is really getting annoying now :/ ANY help would be appreciated! Thanks :)

I have this dev product - It lets me purchase it and it takes my money but doesn't display the gui or change the value :( Any ideas? Thanks!

Script in button in the Workspace:

local MarketplaceService = game:GetService("MarketplaceService")
local productId = 19750967
MarketplaceService.ProcessReceipt = function(receiptInfo) 

for i, player in ipairs(game.Players:GetChildren()) do
    if player.userId == receiptInfo.PlayerId then

        if receiptInfo.ProductId == productId then

        player.PlayerGui.ChoosingMap.Frame.Visible = true
        game.Workspace.ChooseMap.Value = true

        end
    end
end 

return Enum.ProductPurchaseDecision.PurchaseGranted     

end

localscript in the starterpack:

local buyButton = game.Workspace.Choosemapbutton.SurfaceGui.TextButton
local productId = 19750967

buyButton.MouseButton1Click:connect(function()
game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId)
end)


0
Why is the button in workspace? User#9949 0 — 8y
0
It is a surfacegui button jjwood1600 215 — 8y
0
How many times are you defining ProcessReceipt in all of your scripts in that place? Using Ctrl+Shift+F and searching for ProcessReceipt would be the easiest way to find that out. EchoReaper 290 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

Try using the event PromptPurchasedFinished(player,assetId,isPurchased). isPurchased is a bool that is true if the player accepts the purchase.

E.G:

local buyButton = game.Workspace.Choosemapbutton.SurfaceGui.TextButton
local productId = 19750967

buyButton.MouseButton1Click:connect(function()
    local market = game:GetService("MarketplaceService")
    market:PromptPurchaseFinished:connect(function(game.Players.LocalPlayer,    productId,isPurchased)
        if isPurchased then
            -- code
        end
end)

This should be the only script you need.

Ad

Answer this question