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

Why won't this Developer Product script work?

Asked by 10 years ago

So, I have this loading screen. It will eventually wait 1 min and then move on, for now you must pay 1 tix while I am developing the game. When I click the button, nothing happens. It should be doing all the devproduct stuff, and then making the current frame invisible, and the new one visible. Could someone tell me why it doesn't work? Thanks!

local MarketplaceService = game:GetService("MarketplaceService")
local productId = 22106513
loading = game.Players.LocalPlayer.PlayerGui.ScreenGui.loading
results = game.Players.LocalPlayer.PlayerGui.ScreenGui.results

game.Players.PlayerAdded:connect(function()
    print("start")
local DeveloperProducts = game:GetService("MarketplaceService"):GetDeveloperProductsAsync():GetCurrentPage()
for _, DevProductContainer in pairs(DeveloperProducts) do
    for Field, Value in pairs(DevProductContainer) do
        print(Field .. ": " .. Value)
    end
    print(" ")
end
print("end")
end)

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 


    return Enum.ProductPurchaseDecision.PurchaseGranted     
end
end

1 answer

Log in to vote
1
Answered by
AmiracIe 175
10 years ago

I'm pretty sure you have to make the client-sided code, too. From what I can see, you only have the server-sided code.

Here's an example:

local productId=22106513

game.Players.PlayerAdded:connect(function(player)
    MarketplaceService:PromptProductPurchase(game.Players.LocalPlayer, productId)
end)

This should be a local script in StarterGUI or StarterPack. Note that this script doesn't apply to your specific case; this is merely an example.

Ad

Answer this question