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

Why doesn't this script process the PromptPurchaseFinished function?

Asked by 8 years ago
            local MarketplaceService = game:GetService("MarketplaceService")
            local buyButton = game.Workspace["Coin Stand"].Part.SurfaceGui.Frame["1000"]
            local player = game.Players.LocalPlayer
            local id = 25821928
            local isPurchased = true
        buyButton.MouseButton1Click:connect(function()

    MarketplaceService:PromptProductPurchase (player, id, true,  2)


        MarketplaceService.PromptPurchaseFinished:connect(function(player, id, isPurchased)
            if isPurchased then
    player.leaderstats.Coins = game.Players.LocalPlayer.leaderstats.Coins +1000 
end 
    end)
        end) 



Basically a long time ago I created a leaderboard script, it works.

Now after I buy the item, I don't get an extra 1,000 coins to use as I please.... In fact, this line;

MarketplaceService.PromptPurchaseFinished:connect(function(player, id, isPurchased)
            if isPurchased then

Doesn't even run, because apparently even though I'm buying it, It returns false? I even stated that it is true above..

I have used the wiki for this PromptPurchaseFinished part... let's just say the wiki needs a clearer explanation.

And all It needs to do is return true as I am wasting one tix every time I test this code :'(

0
is that the only script? I would have a server script that does the process receipt , then it gives the perk when receipt is confirmed. johnnygadget 50 — 8y
0
Good idea, that way once the receipt is confirmed that means the purchase was confirmed. Server script? I could just do it in this local script, right? legoguy939 418 — 8y

1 answer

Log in to vote
0
Answered by
Kurieita 125
8 years ago

Well in order for a process to work you need to return a Enum

Add

return Enum.ProductPurchaseDecision.PurchaseGranted

At the end of the Process function, then it should work

Accept and thumb up please. :)

0
http://wiki.roblox.com/index.php?title=Enumeration, why enum? The wiki doesn't help me see why to use an Enum... Thanks for giving an answer... But, why are we using an Enum here? legoguy939 418 — 8y
Ad

Answer this question