id = 20518668 --dev product id script.Parent.MouseButton1Click:connect(function(p) 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 p.leaderstats.Cash.Value = p.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)
local plr = script.Parent.Parent.Parent.Parent.Parent.Parent local link = game:GetService("MarketplaceService") deb = 0 script.Parent.MouseButton1Click:connect(function() local marketId = 0 --ID OF YOUR DEVELOPER PRODUCT link:PromptProductPurchase(plr,marketId) link.ProcessReceipt = function(receiptInfo) if Enum.ProductPurchaseDecision.PurchaseGranted and receiptInfo.PlayerId == plr.userId then if deb == 0 then deb = 1 plr.leaderstats.Cash.Value = plr.leaderstats.Cash.Value + 1000 --Alter what stat you would like to increase or decrease after the player has purchased. wait(1) deb = 0 end end 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)
put it in a text button or image button