I'm trying to make a marketplace service shop where you can buy player points. I can't seem to get the script to register that the player has bought the developer product. Can anyone help? This is the script to buy the product:
local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:connect(function() game:GetService("MarketplaceService"):PromptProductPurchase(player, 19642075) end)
and this is the script that is supposed to register the purchase:
local MarketplaceService = Game:GetService("MarketplaceService") local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory") local points = game:GetService("PointsService") local twoPoints = 19642075 MarketplaceService.ProcessReceipt = function(receiptInfo) for i, player in ipairs(game.Players:GetChildren()) do if player.userId == receiptInfo.PlayerId then if receiptInfo.ProductId == twoPoints then points:AwardPoints(player.userId, 2) end end end local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.PurchaseId ds:IncrementAsync(playerProductKey, 1) return Enum.ProductPurchaseDecision.PurchaseGranted end