MysteriaFool

Gamepass Fixed

Nov 11th, 2025
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.42 KB | None | 0 0
  1. local AssetManager = {}
  2.  
  3. local HttpService = game:GetService("HttpService")
  4. local NumbersHelper = require(game:GetService("ReplicatedStorage"):WaitForChild("Common"):WaitForChild("NumberHelpers"))
  5.  
  6. local function handleRequestErrors(success, result, errorMessage)
  7.     if not success then
  8.         warn("Error in HTTP request:", errorMessage)
  9.         return nil
  10.     end
  11.  
  12.     local decodeSuccess, decodedResult = pcall(HttpService.JSONDecode, HttpService, result)
  13.     if not decodeSuccess then
  14.         warn("Error decoding JSON:", decodedResult)
  15.         return nil
  16.     end
  17.  
  18.     return decodedResult
  19. end
  20.  
  21. local function getUserCreatedTShirts(username, SignPrices)
  22.     local tshirts = {}
  23.  
  24.     local success, result = pcall(function()
  25.         return HttpService:GetAsync("https://catalog.roproxy.com/v1/search/items/details?Category=3&CreatorName=" .. username)
  26.     end)
  27.  
  28.     result = handleRequestErrors(success, result, "Failed to retrieve user-created T-shirts")
  29.  
  30.     if result then
  31.         print("T-shirt data:", result)
  32.  
  33.         for _, item in pairs(result.data) do
  34.             if item.price then
  35.                 table.insert(tshirts, item.id)
  36.                 local newBtn = script.Template:Clone()
  37.                 local price = item.price
  38.                 newBtn.PurchaseButton.Text = NumbersHelper.format(tonumber(price)) .. "\u{E002}"
  39.                 newBtn.LayoutOrder = price
  40.                 newBtn.Name = price
  41.                 newBtn.ImportantValues.AssetName.Value = item.name
  42.                 newBtn.ImportantValues.AssetId.Value = item.id
  43.                 newBtn.ImportantValues.AssetType.Value = "Clothing"
  44.                 newBtn.Parent = SignPrices
  45.             end
  46.         end
  47.     end
  48.  
  49.     return tshirts
  50. end
  51.  
  52. local function getUserCreatedGamepasses(userId, boothUI)
  53.     local gamepasses = {}
  54.  
  55.     local GetGamesUrl = "https://games.roproxy.com/v2/users/"..userId.."/games?accessFilter=1&limit=50&sortOrder=Asc"
  56.  
  57.     local success, result = pcall(function()
  58.         return HttpService:GetAsync(GetGamesUrl)
  59.     end)
  60.  
  61.     result = handleRequestErrors(success, result, "Failed to retrieve user's games")
  62.  
  63.     if result and result.data then
  64.         print("Game data:", result)
  65.  
  66.         for _, GameInfo in pairs(result.data) do
  67.             local gameId = GameInfo.id
  68.             local url = "https://games.roproxy.com/v1/games/"..gameId.."/game-passes?limit=100&sortOrder=Asc"
  69.  
  70.             local success2, result2 = pcall(function()
  71.                 return HttpService:GetAsync(url)
  72.             end)
  73.  
  74.             result2 = handleRequestErrors(success2, result2, "Failed to retrieve game passes for game: "..gameId)
  75.  
  76.             if result2 and result2.data then
  77.                 print("Gamepass data for game "..gameId..":", result2)
  78.                 for _, GamepassDetail in pairs(result2.data) do
  79.                     if GamepassDetail.price then
  80.                         table.insert(gamepasses, GamepassDetail.id)
  81.                         local newBtn = script.Template:Clone()
  82.                         local price = GamepassDetail.price
  83.                         newBtn.Name = price
  84.                         newBtn.PurchaseButton.Text = NumbersHelper.format(tonumber(price)) .. "\u{E002}"
  85.                         newBtn.LayoutOrder = price
  86.                         newBtn.ImportantValues.AssetId.Value = GamepassDetail.id
  87.                         newBtn.ImportantValues.AssetName.Value = GamepassDetail.displayName
  88.                         newBtn.ImportantValues.AssetType.Value = "Gamepass"
  89.                         newBtn.Parent = boothUI
  90.                     end
  91.                 end
  92.             end
  93.         end
  94.     end
  95.  
  96.     return gamepasses
  97. end
  98.  
  99.  
  100.  
  101. function AssetManager:GetAssets(Player, BoothUI)
  102.     getUserCreatedTShirts(Player.Name, BoothUI)
  103.     getUserCreatedGamepasses(Player.UserId, BoothUI)
  104. end
  105.  
  106. function AssetManager:GetAssetsGift(PlayerName, PlayerUserId, BoothUI)
  107.     getUserCreatedTShirts(PlayerName, BoothUI)
  108.     getUserCreatedGamepasses(PlayerUserId, BoothUI)
  109. end
  110.  
  111. return AssetManager
Advertisement
Add Comment
Please, Sign In to add comment