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

How do i check if a developer product purchase has finished?

I'm making a donation button and it works. But i also want a donation board wich also works.

But how would i check if a product purchase has been finished? So i can give the player the points for the leaderboard?

script.Parent.MouseButton1Click:Connect(function()
	local player = script.Parent.Parent.Parent.Parent.Parent
	local marketplaceservice = game:GetService("MarketplaceService")
	local purchase = marketplaceservice:PromptProductPurchase(player, 1138590988)
end)

2 comments

0

can you show me your developer product script?

0

Edited

1 answer

✓ Accepted answer

There is an event for developer products called MarketplaceService.PromptPurchaseFinished, it's an event that fires when you close the prompt popup, it returns 3 arguments, player, dev product id and did purchase. For gamepasses, roblox wiki recommends using PromptGamePassPurchaseFinished.

Here is example of the event you will be needed:

local MarketplaceService = game:GetService('MarketplaceService')

local function OnPrompted(Gamer, AssetId, DidPurchase)
	if (DidPurchase) then
		print(string.format('%s has purchased asset with id: %d', Gamer.Name, AssetId)
	else
		warn(string.format('%s has denied the offer!!!!!!!!!!!!!!'), Gamer.Name)
		Gamer:Kick('You denied prompt purchase!!')
	end
end
MarketplaceService.PromptPurchaseFinished:Connect(OnPrompted)

Read about MarketplaceService here.

1 comment

0

Thanks!

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