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.

7 comments
Oh ok someone told me a regular
game.Players.LocalPlayer can only be called from a LocalScript. Thats the tell-tale sign
I will come back and say if it works
Ok so it said it wouldn't work because roblox is performing matanence why is this?
It still wont work any help?
If it says ROBLOX is performing maintenance it means that your trying to buy a developer product from another place. Are you sure this developer product id is for the developer product in your place?
Yes I mistyped the Dev Id I have it working now thanks!