When I was testing my own developer product for a game I am making, it prompts the purchase.. However when I press the buy button, it says that Roblox is under maintanence.. Any reason why that would come up? Maybe an anti scam because something is wrong with my script?
Script 1- Located in the button you press to prompt the purchase
wait(1) local player = game.Players.LocalPlayer local button = script.Parent local productId = button.ID.Value -- button.MouseButton1Click:connect(function() Game:GetService("MarketplaceService"):PromptProductPurchase(player, productId) end)
Script 2- Located in Server Script Service -Makes sure that they bought it and gives them the cash
local MarketplaceService = Game:GetService("MarketplaceService") local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory") CASHID = 19575333 CashAmount = script.Cash --This is the IntValue located inside of this script (The Child) MarketplaceService.ProcessReceipt = function(receiptInfo) local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_product_" .. receiptInfo.ProductId local numberBought = ds:IncrementAsync(playerProductKey, 1) for i,v in pairs (game.Players:GetChildren()) do if v.userId == receiptInfo.PlayerId then if receiptInfo.ProductId == CASHID then lds = v.PlayerGui.Currency.CurrencyFrame.Money.Amount --This is there Currency GUI if lds ~= nil then cs = lds.Value if cs ~= nil then cs.Value = cs.Value + CashAmount.Value end end end end end return Enum.ProductPurchaseDecision.PurchaseGranted end
For script 1, You put a ")"
Next to the end. That ")"
is for Global Functions.