Can you help me with selling Dev Products? I made my products I just need a script that sells them. I am using a GUI and am trying to sell player points.
here's a script that doesn't work:
local buyButton = script.Parent local productId = 20139068 local Plr = script.Parent.Parent
buyButton.MouseButton1Click:connect(function() Game:GetService("MarketplaceService"):PromptProductPurchase(Plr, productId) end)
local MarketplaceService = Game:GetService("MarketplaceService")
MarketplaceService.PromptProductPurchaseFinished:connect(function(userId, productId, isPurchased) if isPurchased then
end end)
Why isn't it working? D:
This would go in a regular script inside of the GUI Button. Make sure to read the comments. Only reason it can't be in a LocalScript is.. erm... Forgot. I remember reading it on the Wiki.
id = 20139068 --dev product id p = script.Parent.Parent -- Make this lead to the Parent of StarterGui script.Parent.MouseButton1Down:connect(function() game:GetService("MarketplaceService"):PromptProductPurchase(p, id) local MarketplaceService = Game:GetService("MarketplaceService") local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory") MarketplaceService.ProcessReceipt = function(receiptInfo) if p.userId == receiptInfo.PlayerId then if receiptInfo.ProductId == id then game:GetService("PointsService"):AwardPoints(p.userId, 1) --1 is the amount of playerpoints that are awarded 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)
Marked as Duplicate by User#2
This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.
Why was this question closed?