You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
When a player clicks on the purchase button to buy more in-game money, the gamepass prompt shows and they’re able to buy the money.
What is the issue? Include screenshots / videos if possible!
When clicking on the button, it says that an error claiming that the purchase failed because something went wrong.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve been following many tutorials for this and all of them have given me the same error. I was just hoping that someone was able to help me out so I can finish this part of my game.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
This is the script inside of the purchase button:
MPS = game:GetService("MarketplaceService")
id = 270635080
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
MPS:PromptProductPurchase(player, id)
end)
This is the script inside of ServerScriptService
local MPS = game:GetService("MarketplaceService")
MPS.ProcessReceipt = function(receiptInfo)
if receiptInfo.ProductId == 270635080 then
local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
player.leaderstats.Pounds.Value = player.leaderstats.Pounds.Value + 100000
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end