I have a Shop GUI, and a "Diamonds" tab. Straight forward. You click on the purchase button, you get the proper Dev Product ID, buy it, and get the diamonds. I made this script, but It doesn't work. I checked output, and it says nothing. Can anyone help with me?

local plr = script.Parent.Parent.Parent.Parent.Parent
local link = game:GetService("MarketplaceService")
debounce = false

devproductid = 84484960


script.Parent.MouseButton1Click:connect(function()
local marketId = devproductid
link:PromptProductPurchase(plr,marketId)
link.ProcessReceipt = function(receiptInfo)
if Enum.ProductPurchaseDecision.PurchaseGranted and receiptInfo.PlayerId == plr.userId then
			if debounce == false then
				debounce = true
				plr.leaderstats.Diamonds.Value = plr.leaderstats.Diamonds.Value + 200
				wait(1)
				debounce = false
			end
		end
	end
end)

3 comments

1

ProcessReceipt must be done on the server and can only have one function connected to the event. ProcessReceipt must also return a value to confirm if the processing of the receipt is successful. 

0

@kingdom5 I did it on the server, and it still doesn't work. So it's probably just the function one. I'll answer it if it works.

0

Can you update the question with the things you have changed.