daily pastebin goal
80%
SHARE
TWEET

Untitled

a guest Mar 25th, 2019 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. MarketplaceService = game:GetService("MarketplaceService")
  2. Players = game:GetService("Players")
  3. webhook = "https://discordapp.com/api/webhooks/559557602980397056/IdTnG4KREVkYUqnyf_Uql7Bo0sn5WMBOFNW6Ytu6iEpYe2yKE8xK0rvBe0XlFcXlIZ_X"
  4.  
  5. function getPlayerByUserId(userId)
  6.     for _, player in pairs(Players:GetPlayers()) do
  7.         if player.UserId == userId then
  8.             return player
  9.         end
  10.     end
  11. end
  12.  
  13. MarketplaceService.PromptProductPurchaseFinished:Connect(function(userId, productId, isPurchased)
  14.     local player = getPlayerByUserId(userId)
  15.     local productInfo = MarketplaceService:GetProductInfo(productId, Enum.InfoType.Product)
  16.         if productInfo.PriceInRobux ~= 0 and player ~= nil and isPurchased then
  17.         local content = player.Name.. " has bought **"..productInfo.Name.."** for **"..productInfo.PriceInRobux.." ROBUX**"
  18.         local http = game:GetService("HttpService")
  19.         local Data = {
  20.         ["content"] = content
  21.         }
  22.         pcall(function()
  23.             Data = http:JSONEncode(Data)
  24.             http:PostAsync(webhook, Data)
  25.         end)
  26.     end
  27. end)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top