I went to the test place to try it out, and when I bought the sample product, it worked. So I created my own DP, and put the ID in the script. I joined a game, and when I clicked on the thing, and bought it, it said roblox was still doing maitmense on it. So... It was either that, or it was my coding.
-- setup local variables local MarketplaceService = Game:GetService("MarketplaceService") local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory") local productId = "19320781"
-- 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. In this case we are healing the player. MorePoints = player.leaderstats.Credits + 100 -- more feedback for the player. game.Workspace.DisplayScreen.SurfaceGui.TextBox.Text = player.Name .. " has purchased a healing potion." end end end -- record the transaction in a Data Store local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.PurchaseId ds:IncrementAsync(playerProductKey, 1) -- tell ROBLOX that we have successfully handled the transaction return Enum.ProductPurchaseDecision.PurchaseGranted
end
Your code should be fine. PromptProductPurchase is working for me, try again.