Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Inside of the purchase gui:
- local buyButton = script.Parent
- local productId = 20308410
- buyButton.MouseButton1Click:connect(function()
- game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId)
- end)
- Inside of the tool that is supposed to be awarded:
- local MarketplaceService = Game:GetService("MarketplaceService")
- local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
- local productId = 20308410
- MarketplaceService.ProcessReceipt = function(receiptInfo)
- for i, player in ipairs(game.Players:GetChildren()) do
- if player.userId == receiptInfo.PlayerId then
- if receiptInfo.ProductId == productId then
- local mk = game.Lighting.Medkit:clone()
- mk.Parent = player.StarterGear
- local h = Instance.new("Hint", game.Workspace)
- h.Text = player.Name .. " has purchased an item, creating more player points!"
- end
- end
- end
- local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.PurchaseId
- ds:IncrementAsync(playerProductKey, 1)
- return Enum.ProductPurchaseDecision.PurchaseGranted
- end
Advertisement
Add Comment
Please, Sign In to add comment