So im trying to make it show a gui when you buy it. but its not showing the gui. it prints but it doesnt show the gui
--Local script workspace.RequestScreen.SurfaceGui:WaitForChild("Button").MouseButton1Click:connect(function() game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, 32468783) end) game:GetService("ServerStorage"):WaitForChild("Request").OnClientEvent:connect(function() local SongPicker = game.ReplicatedStorage.Requesting:Clone() SongPicker.Parent = game.Players.LocalPlayer.PlayerGui local CloneExploitChecker = Instance.new("StringValue", SongPicker) CloneExploitChecker.Name = ("Check"..game.Players.LocalPlayer.Name) end)
--Regular Script local MarketplaceService = game:GetService("MarketplaceService") MarketplaceService.ProcessReceipt = function(receiptInfo) for i, player in ipairs(game.Players:GetChildren()) do if player.userId == receiptInfo.PlayerId then if receiptInfo.ProductId == 32468783 then print("works") game:GetService("ServerStorage"):WaitForChild("Request"):FireClient(player) end end end return Enum.ProductPurchaseDecision.PurchaseGranted end
You can only process receipts in a server script. However, the key is to take the player who bought your product and send it to a RemoteEvent when you have processed the payment, and handle that payment by making the script use the player instead of the LocalPlayer.