This tutorial is just showing how to create a catalog scraper for your group, and how to check if a player owns those items in a game. This can be used alongside other API wrappers such as noblox.js to auto rank players in your game.
To begin, create an account on replit, then go to the project linked below, and fork it.
https://replit.com/@tylerfitzy/groupCatalog?v=1
Once in your workspace, you should automatically be put in the editor for the index.js file. Once here, change the group ID to the ID of the group that you want to scrape.
Once you have changed that, start the program, and let it run until you see it print:
Once that has been printed, copy the link seen below, and paste it into your browser. If you see a json file being displayed with the correct items, it is working.
We will now shift to Roblox Studio to use the list created in your game.
Once in studio, create a new file in ServerScriptService. Now, copy the code below and paste it in.
local https = game:GetService("HttpService")
local mps = game:GetService("MarketplaceService")
local replitUrl = "https://groupcatalog.tylerfitzy.repl.co/"
local plrOwnsAsset = mps.PlayerOwnsAsset
local itemsOwned = {}
game.Players.PlayerAdded:Connect(function(plr)
local res = https:GetAsync(replitUrl)
local items = https:JSONDecode(res)
for i, v in pairs(items) do
local success, owns = pcall(plrOwnsAsset, mps, plr, i)
if owns then
itemsOwned[#itemsOwned-1] = i
print(plr.Name .. " owns " .. v)
else
print(plr.Name .. " doesn't own " .. v)
end
end
print("Player owns "..#itemsOwned.." items.")
end)
Change the Replit URL to the one that you pasted in earlier. It should be similar to the format of mine.
The IDs of the items owned are put into the itemsOwned table, and it prints out if an item is owned or not. You can now use these values to do whatever you like, such as create an auto ranking system.
If you run into any errors, feel free to let me know