Developer product purchase not working?

local script triggers purchase


local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

script.Parent.MouseButton1Click:connect(function() --DONT CHANGE THIS
	local player = Players.LocalPlayer
	MarketplaceService:PromptProductPurchase(player, 1229353059)
end)

process purchase server script in workspace


local MPS = game:GetService("MarketplaceService")

local pass = 1229353059

MPS.PromptPurchaseFinished:Connect(function(player, purchaseID, purchaseSuccsesfull)
	if purchaseSuccsesfull == true and purchaseID == pass then
		script.bought:Play()
		game.Workspace:SetAttribute("money", game.Workspace:GetAttribute("money") + 30)
		print("BOUGHT 30 COINS")
	end
end)

and nothing happens… nothing appears in the output window

The MarketplaceService.PromptPurchaseFinished event only fires for sales of gears/other assets (such as shirts). You might want to then switch to MarketplaceService.PromptProductPurchaseFinished, but the documentation very sternly warns you to NOT do that.

Using the MarketplaceService.ProcessReceipt callback is recommended instead. See the documentation for that here:
https://developer.roblox.com/en-us/api-reference/callback/MarketplaceService/ProcessReceipt

1 Like