Advertisement
ToxicTheBoss

Gamepass Revenue Calculator

Jun 18th, 2020
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. print("Request started.");
  2.  
  3. local info = game:GetService("HttpService"):JSONDecode(game:HttpGet('https://games.roblox.com/v1/games/'..game.GameId..'/game-passes?sortOrder=Asc&limit=50'))
  4. local gpids = {}
  5. local total = 0;
  6.  
  7. for i,v in pairs(info.data) do
  8. if v.price then
  9. table.insert(gpids,v.id)
  10. end
  11. end
  12.  
  13. print("Got gamepass ids");
  14.  
  15. function commas(number)
  16.  
  17. local i, j, minus, int, fraction = tostring(number):find('([-]?)(%d+)([.]?%d*)')
  18.  
  19. int = int:reverse():gsub("(%d%d%d)", "%1,")
  20. local s = minus .. int:reverse():gsub("^,", "") .. fraction
  21. s = string.split(s,'.')[1];
  22. return s;
  23. end
  24.  
  25.  
  26. for i,v in pairs(gpids) do
  27. local req = game:GetService("HttpService"):JSONDecode(game:HttpGet('https://api.roblox.com/marketplace/game-pass-product-info?gamePassId='..v));
  28. local sales = req.Sales;
  29. local price = req.PriceInRobux;
  30. price = math.floor(price * .70);
  31. local amount = price * sales;
  32. total = total + amount;
  33. end
  34.  
  35. print("Totalled")
  36. total = math.floor(total);
  37.  
  38. messagebox('Calculated Revenue:'..'\n'..'Robux: '..commas(total)..'\n'..'USD: '..commas(total/100000*350),'Notification:',0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement