This LocalScript is locating in a textbutton, and on click it should promptpurchase, and if purchased change the visible property of two frames. When I click it, it doesn't do anything. Yes, my hierarchies are correct and no, I cannot show the output, because you can't purchase developer products in studio apparently.
local productId = 22903689 player = game.Players.LocalPlayer gui = player.PlayerGui.ScreenGui loading = gui.loading results = gui.results MarketplaceService = game.GetService("MarketplaceService") script.Parent.MouseButton1Down:connect(function(player) game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId) MarketplaceService.ProcessReceipt = function(receiptInfo) for i, player in ipairs(game.Players:GetChildren()) do if player.userId == receiptInfo.PlayerId then if receiptInfo.ProductId == productId then loading.Visible = false results.Visible = true end end end end end)
Your problem is that, unfortunately, you cannot set the ProcessReceipt for MarketplaceService with a localscript
.
So, to fix? You need to have the ProcessReceipt in a serverscript, preferably in ServerScriptStorage.