I’m making a script which checks how many items of clothing the user owns from a group, however there is 5000+ items of clothing in the group. Knowing you’d have to loop through all items, is there a “hacky” way of bypassing this?
You’re right, looping through all your clothing items to check if the user owns them isn’t a great idea.
I think you could use a proxy server and access this API:
The max items you can see on each page is over 100, realistically you should only have to make less than 5 requests in total to get the users full shirt inventory. You could then have a web API that basically parses through all the pages and returns a JSON list of the clothes if they match the creator id of your group.
Then if you wanted to check if they own your clothes, just make a request to your API in-game. It’s not fully elegant, but should work most of the time.
I have one of my own:
https://robloxdevforumproxy.glitch.me
You can do this:
local InventoryUrl = "https://robloxdevforumproxy.glitch.me/users/inventory/list-json?assetTypeId=11&cursor=&itemsPerPage=100&pageNumber=%x&sortOrder=Desc&userId=%i" -- used in a string.format thingy
...
-- In an event
local Inventory = HttpService:JSONDecode(HttpService:GetAsync(string.format(InventoryUrl, 1, Player.UserId))) -- function
for _, item in next, Inventory do
-- do stuff
end
While this works good, do you have a source people can use to make their own?
Relying on someone else’s service is something anyone would like to avoid in production.
I have a link: