So I'm making a shop GUI where u can purchase in-game currency with Robux. Inside the buy button, I have this code:
local MPS = game:GetService("MarketplaceService") id = 965863777 local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function() MPS:PromptProductPurchase(player, id) end)
---------------------------------------------Inside of script storage, I have a script with this code inside:
local MPS = game:GetService("MarketplaceService") MPS.ProcessReceipt = function(receiptInfo) if receiptInfo.ProductId == 965863777 then local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId) player.Stats.Bank.Value = player.Stats.Bank.Value + 500 player.PlayerGui.ScreenGui.btnMoney.Text = "$" .. player.Stats.Bank.Value .. ""
player.PlayerGui.ScreenGui.mainFrame.Visible = false player.PlayerGui.ScreenGui.btnWithCust1.Visible = false player.PlayerGui.ScreenGui.btnWithCust2.Visible = false player.PlayerGui.ScreenGui.btnWithCust3.Visible = false player.PlayerGui.ScreenGui.btnWithCust4.Visible = false player.PlayerGui.ScreenGui.btnBuyCash.Text = "Bank" player.PlayerGui.ScreenGui.lblTransComp.Visible = true wait(5) player.PlayerGui.ScreenGui.lblTransComp.Visible = false return Enum.ProductPurchaseDecision.PurchaseGranted end
end
This will run fine for one value of currency I'm offering the user to buy, but if I say offer them this purchase for $500 and another for $1000 which I do by simply repeating the code and just changing the product id, only the $500 will purchasable and it will break without giving me an error message when buying the $1000. I would appreciate any feedback, thanks.