Hey, I used the Roblox wiki example of how to create a buy button so that the client can click it and pay Robux to add money to their leaderboard. It used to work on my game, but now it no longer does. I'm wondering if this has anything to do with the fact that I clicked filtering enabled on my game. If so, why would Roblox give an example of how to make a buy button that does not work with filtering enabled, especially since not having that box clicked renders your game irrelevant since it is not searchable in experimental mode. Has anyone else had this problem? If FE is the problem does someone know how to make a buy button that works with FE on? Here's the script from Roblox wiki, Developer Products:
--LocalScript in StarterPack -- setup local variables local buyButton = game.Workspace.BuyButton.SurfaceGui.TextButton local productId = 20518668
-- when player clicks on buy brick prompt him/her to buy a product buyButton.MouseButton1Click:connect(function() game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId) end)
--Script in BuyButton part -- setup local variables local MarketplaceService = Game:GetService("MarketplaceService") local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory") local productId = 20518668
-- define function that will be called when purchase finished MarketplaceService.ProcessReceipt = function(receiptInfo)
-- find the player based on the PlayerId in receiptInfo for i, player in ipairs(game.Players:GetChildren()) do if player.userId == receiptInfo.PlayerId then -- check which product was purchased if receiptInfo.ProductId == productId then -- handle purchase player.leaderstats.Money.Value = player.leaderstats.Money.Value + 5 end end end -- record the transaction in a Data Store local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.ProductId ds:IncrementAsync(playerProductKey, 1) -- tell Roblox that we have successfully handled the transaction return Enum.ProductPurchaseDecision.PurchaseGranted