Guest User

Developer Products

a guest
Jun 28th, 2014
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. Inside of the purchase gui:
  2.  
  3.  
  4.  
  5. local buyButton = script.Parent
  6. local productId = 20308410
  7.  
  8. buyButton.MouseButton1Click:connect(function()
  9. game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId)
  10. end)
  11.  
  12.  
  13.  
  14. Inside of the tool that is supposed to be awarded:
  15.  
  16.  
  17.  
  18. local MarketplaceService = Game:GetService("MarketplaceService")
  19. local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
  20. local productId = 20308410
  21.  
  22. MarketplaceService.ProcessReceipt = function(receiptInfo)
  23.  
  24.  
  25. for i, player in ipairs(game.Players:GetChildren()) do
  26. if player.userId == receiptInfo.PlayerId then
  27.  
  28.  
  29.  
  30. if receiptInfo.ProductId == productId then
  31.  
  32.  
  33. local mk = game.Lighting.Medkit:clone()
  34. mk.Parent = player.StarterGear
  35. local h = Instance.new("Hint", game.Workspace)
  36. h.Text = player.Name .. " has purchased an item, creating more player points!"
  37. end
  38. end
  39. end
  40.  
  41. local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.PurchaseId
  42. ds:IncrementAsync(playerProductKey, 1)
  43.  
  44. return Enum.ProductPurchaseDecision.PurchaseGranted
  45. end
Advertisement
Add Comment
Please, Sign In to add comment