What is the issue with this code?

I made this a while ago, and still havent figured out whats wrong with this code:

--Server script
local MPS = game:GetService("MarketplaceService")

MPS.ProcessReceipt = function(receiptInfo)
	if receiptInfo.ProductId == "1176113807" then
		local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 1700
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
end

Basically, it lets you buy our coins (currency) ingame. Here is also the code for making the prompt, which i parented to the gui button:

--Local script
MPS = game:GetService("MarketplaceService")

id = 1176113807

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Down:Connect(function()

MPS:PromptProductPurchase(player, id)

end)

The issue is yes, it does prompt it, but when you purchase the dev product, it wont give the coins.

1 Like

MarketplaceService.ProcessReceipt look at this hope this helped you

1 Like

dont do what i said lol (try to remove the last line in the local script, i mean the end))

That will break it you need the end

ups i was wrong its a even idk why i dont see it

print the player i think???

can you make sure productId matches the actual product you want to sell

Could I see the full code in both scripts?

I have listed both scripts’ code, idk what you mean.

Yep, it matches, i checked that a few times to make sure.