Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Developer Product Gui Button simplified by TehRandoms--
- local devProductId = script.ID.Value --The Developer Product ID if your item, must be a Product of the game place it is in
- local player = script.Parent.Parent.Parent.Parent.Parent
- --Well, as always, don't touch anything below if you have no idea what you are doing--
- --Prompt Buy--
- script.Parent.MouseButton1Click:connect(function()
- game:GetService("MarketplaceService"):PromptProductPurchase(player, devProductId)
- end)
- --Transaction--
- local MarketplaceService = game:GetService("MarketplaceService")
- local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
- MarketplaceService.ProcessReceipt = function(receiptInfo)
- for i, player in ipairs(game.Players:GetChildren()) do
- if player.userId == receiptInfo.PlayerId then
- if receiptInfo.ProductId == devProductId then --you can put the event here, or whatever
- player.Coins.Value = player.Coins.Value + 10
- end
- end
- end
- local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.ProductId
- ds:IncrementAsync(playerProductKey, 1)
- return Enum.ProductPurchaseDecision.PurchaseGranted
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement