I have got this for my developer product to add 5000 cash but it wont work please help.
id = 20566241 --dev product id script.Parent.MouseButton1Click:connect(function() game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, id) local MarketplaceService = Game:GetService("MarketplaceService") local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory") MarketplaceService.ProcessReceipt = function(receiptInfo) if game.Players.LocalPlayer.userId == receiptInfo.PlayerId then if receiptInfo.ProductId == id then game.Players.LocalPlayer.leaderstats.Cash.Value = game.Players.LocalPlayer.leaderstats.Cash.Value + 5000 end end -- record the transaction in a Data Store local playerProductKey = receiptInfo.PlayerId .. "_got_" .. receiptInfo.PurchaseId ds:IncrementAsync(playerProductKey, 1) -- tell ROBLOX that we have successfully handled the transaction return Enum.ProductPurchaseDecision.PurchaseGranted end end)
The error is that it wont give me the 5000 cash and I have to reset to buy it again.
This needs to be in a local script inside a GUI within your game, not a regular script. I'm not sure if its already in a local script or not but at first glance seems the most likely error