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

What is wrong with this DeveloperProduct script?

Asked by 9 years ago

This LocalScript is locating in a textbutton, and on click it should promptpurchase, and if purchased change the visible property of two frames. When I click it, it doesn't do anything. Yes, my hierarchies are correct and no, I cannot show the output, because you can't purchase developer products in studio apparently.

local productId = 22903689
player = game.Players.LocalPlayer
gui = player.PlayerGui.ScreenGui
loading = gui.loading
results = gui.results
MarketplaceService = game.GetService("MarketplaceService")

script.Parent.MouseButton1Down:connect(function(player)
    game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId)
    MarketplaceService.ProcessReceipt = function(receiptInfo) 



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



            if receiptInfo.ProductId == productId then 
                loading.Visible = false
                results.Visible = true
            end
        end 
    end
    end


    end)
0
Yes this is a re-post, the first time all I got were troll answers :/ Antharaziia 75 — 9y

1 answer

Log in to vote
1
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
9 years ago

Your problem is that, unfortunately, you cannot set the ProcessReceipt for MarketplaceService with a localscript.

So, to fix? You need to have the ProcessReceipt in a serverscript, preferably in ServerScriptStorage.

0
Okay thanks, how would I do that? I am a novice scripter lol Antharaziia 75 — 9y
0
line 10 - 25 should be in a separate script in SeverScriptStorage. Goulstem 8144 — 9y
Ad

Answer this question