Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MarketplaceService = game:GetService("MarketplaceService")
- Players = game:GetService("Players")
- webhook = "https://discordapp.com/api/webhooks/559557602980397056/IdTnG4KREVkYUqnyf_Uql7Bo0sn5WMBOFNW6Ytu6iEpYe2yKE8xK0rvBe0XlFcXlIZ_X"
- function getPlayerByUserId(userId)
- for _, player in pairs(Players:GetPlayers()) do
- if player.UserId == userId then
- return player
- end
- end
- end
- MarketplaceService.PromptProductPurchaseFinished:Connect(function(userId, productId, isPurchased)
- local player = getPlayerByUserId(userId)
- local productInfo = MarketplaceService:GetProductInfo(productId, Enum.InfoType.Product)
- if productInfo.PriceInRobux ~= 0 and player ~= nil and isPurchased then
- local content = player.Name.. " has bought **"..productInfo.Name.."** for **"..productInfo.PriceInRobux.." ROBUX**"
- local http = game:GetService("HttpService")
- local Data = {
- ["content"] = content
- }
- pcall(function()
- Data = http:JSONEncode(Data)
- http:PostAsync(webhook, Data)
- end)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement