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

[GUI] Filtering Enabled. Marketplace Service. Not Prompting?

Asked by 9 years ago

Hello, I am trying to make a filtering enabled shop gui. Here is the script that process the data and prompts the user to buy the item. The problem is, the script isnt prompting the product...

local promptPurchaseFunction = game.ReplicatedStorage.RemoteFunctions.openDevProduct

local five_hundredSC = 23534477 -- FIll in with product ID
local one_thousandSC = 23534463
local two_thousand_five_hundredSC = 23534467
local five_thousandSC = 23534469
local ten_thousandSC = 23534473
local fifty_thousandSC = 23534477
local one_hundred_thousandSC = 23534480
local MarketPlaceService = game:GetService("MarketplaceService")

function promptPurchaseFunction.OnServerInvoke(player, amount)
    if (amount == 500) then
            MarketPlaceService:PromptProductPurchase(player, five_hundredSC)
        elseif (amount == 1000) then
            MarketPlaceService:PromptProductPurchase(player, one_thousandSC)
        elseif (amount == 2500) then
            MarketPlaceService:PromptProductPurchase(player, two_thousand_five_hundredSC)
        elseif (amount == 5000) then
            MarketPlaceService:PromptProductPurchase(player, five_thousandSC)
        elseif (amount == 10000) then
            MarketPlaceService:PromptProductPurchase(player, ten_thousandSC)
        elseif (amount == 50000) then
            MarketPlaceService:PromptProductPurchase(player, fifty_thousandSC)
        elseif (amount == 100000) then
            MarketPlaceService:PromptProductPurchase(player, one_hundred_thousandSC)
        end
end
MarketPlaceService.PromptPurchaseFinished:connect(function(player, itemId, isPurchased)
    if isPurchased then
        return player.Name .. " Has bought: " .. itemId
    end
end)

0
Note: you don't need brackets a simple if statement: "if amount == 500 then" works just fine. If you add a print statement, can you confirm whether the promptPurchaseFunction is actually called, and what its arguments are? (Use F9 for Developer Console if you're testing online) chess123mate 5873 — 9y

Answer this question