Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why doesn't this script process the PromptPurchaseFinished function?

			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 :'(

2 comments

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.

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?

1 answer

✓ Accepted answer

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. :)

2 comments

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?

This discussion is preserved as it was. New answers, comments, and votes are closed.