Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local AssetManager = {}
- local HttpService = game:GetService("HttpService")
- local UrlA = "https://catalog.roproxy.com/v1/search/items/details?Category=3&CreatorName="
- local function getUserGeneratedTShirtsRecursive(username, SignPrices, tshirts, cursor)
- tshirts = tshirts or {}
- local requestUrl = UrlA
- local data = HttpService:JSONDecode(HttpService:GetAsync(UrlA .. username)).data
- if data then
- table.sort(data,
- function(a,b)
- return a.price < b.price
- end
- )
- for _, item in ipairs(data) do
- local e,s = pcall(function()
- table.insert(tshirts, item.id)
- local newBtn = script.Template:Clone()
- local price = item.price
- newBtn.PurchaseButton.Text = "$"..price
- newBtn.LayoutOrder = price
- newBtn.Name = price
- newBtn.ImportantValues.AssetId.Value = item.id
- newBtn.Parent = SignPrices
- end)
- end
- end
- return tshirts
- end
- local UrlB = "https://www.roproxy.com/users/inventory/list-json?assetTypeId=34&cursor=&itemsPerPage=100&pageNumber=%s&userId=%s"
- local function getUserCreatedGamepassesRecursive(userId, SignPrices, gamepasses, pageNumber, lastLength)
- gamepasses = {}
- pageNumber = pageNumber or 1
- lastLength = lastLength or math.huge
- local requestUrl = UrlB:format(pageNumber, userId)
- local success, result = pcall(function()
- return HttpService:GetAsync(requestUrl)
- end)
- if success then
- if result then
- local success2, result2 = pcall(function()
- return HttpService:JSONDecode(result)
- end)
- if success2 then
- if result2 then
- for _, gamepass in ipairs(result2.Data.Items) do
- if gamepass.Creator.Id == userId and table.find(gamepasses, gamepass.Item.AssetId) == nil then
- table.insert(gamepasses, gamepass.Item.AssetId)
- local e,s = pcall(function()
- local newBtn = script.Template:Clone()
- local price = gamepass.Product.PriceInRobux
- newBtn.Name = price
- newBtn.PurchaseButton.Text = "$"..price
- newBtn.LayoutOrder = price
- newBtn.ImportantValues.AssetId.Value = gamepass.Item.AssetId
- newBtn.ImportantValues.AssetType.Value = "Gamepass"
- newBtn.Parent = SignPrices
- end)
- end
- end
- else
- warn(result)
- getUserCreatedGamepassesRecursive(userId, gamepasses, pageNumber, lastLength)
- end
- end
- else
- warn(result)
- getUserCreatedGamepassesRecursive(userId, gamepasses, pageNumber, lastLength)
- end
- return gamepasses
- end
- end
- function AssetManager:GetAssets(Player, BoothUI)
- getUserGeneratedTShirtsRecursive(Player.Name, BoothUI)
- getUserCreatedGamepassesRecursive(Player.UserId, BoothUI)
- end
- return AssetManager
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement