Hello, I’m trying to get a list of a players avatar items. I noticed my current system is extremely inefficient and fires like 30 http requests. Is there a way I can limit it to one?
(It loops through a table of inventory types and sends a request for each one then puts it into a table.)
script: local HttpService = game:GetService("HttpService");
local remote = game.ReplicatedStorage.Inventory
local clothings = {
"TShirt","Hat","Shirt","Pants","Head","Face","Torso","RightArm","LeftArm","LeftLeg","RightLeg","Package","HairAccessory","FaceAccessory","NeckAccessory","ShoulderAccessory","FrontAccessory","BackAccessory","WaistAccessory","TShirtAccessory","ShirtAccessory","PantsAccessory","JacketAccessory","SweaterAccessory","ShortsAccessory","LeftShoeAccessory","RightShoeAccessory","DressSkirtAccessory"
}
local keepgoing = false
remote.OnServerInvoke = function(plr, UserId)
local followers = {};
for i,category in pairs(clothings) do
print("running")
local url = ("https://inventory.roproxy.com/v2/users/%s/inventory?assetTypes="..category.."&limit=100&sortOrder=Asc"):format(tostring(UserId))
local success, output = pcall(function() return HttpService:JSONDecode(HttpService:GetAsync(url)) end);
if not (success) then
print(output .. " was caused because of a nooby item known as: " .. category)
return followers
end
for _, v in pairs(output.data) do
table.insert(followers, {Name = v.name; Category = category; Ca = "Avatar"});
end
end
return followers;
end
Note: sorry i would love to provide my sources but I can’t find them at the moment. How would i limit all of these requests into 1 request since I have to wait forever with this current system