Introduction
Ok so, here’s the thing. Typically, roblox doesn’t allow you to use their own API from roblox. You’ll have to get a little bit hacky with JavaScript.
Fortunately enough, there’s a website for FREE JavaScript app hosting. It’s called glitch. You can do this very simply using a library called request and the built in node.js library called http.
Setting It Up
First, once you’ve signed up: Create a new hello-express app.
Secondly, clear out the server.js and go to package.json.
Once you’re in package.json
, you will want click Add Package.
Search “request” and click it. It should install. Once you’ve done that, you should delete the folders called “/views” and “/public”.
Adding Packages
JavaScript Code
You can now type this code into the file called server.js
const http = require("http");
const request = require("request");
http.createServer((req, res) => {
try {
let url = request.get("https://www.roblox.com" + req.url);
url.on("response", response => {
if (response && response.headers) {
url.pipe(res);
}
});
} catch (e) {
res.write(e);
res.end();
}
}).listen(process.env.PORT, () => console.log("listening on " + process.env.PORT))
Done! Now you can go to https://yourapp.glitch.me/catalog/json (replace yourapp with the name of your app)
and you can view the api of the catalog!
Alternatively, you can use my app for this and copy it: app link
Roblox End
On roblox, you can use HttpService on the client and get the items on the server. Keep in mind, I’m on mobile so I can’t show you what it will look like.
local HttpService = game:GetService("HttpService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteFunction = ReplicatedStorage:WaitForChild("RemoteFunction") -- change the name to your liking, also don't forget to create a RemoteFunction
local appName = "robloxdevforumproxy" -- replace it with your app
local baseUrl = "https://" .. appName .. ".glitch.me/catalog/json"
function RemoteFunction.OnServerInvoke()
return HttpService:JSONDecode(HttpService:GetAsync(baseUrl))
end
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteFunction = ReplicatedStorage:WaitForChild("RemoteFunction") -- change the name to your liking, also don't forget to create a RemoteEvent
local CatalogApi = RemoteFunction:InvokeServer() -- returns a list, use this to duplicated ui elements to your liking.
local GearFrame = script.Parent.GearFrame
Conclusion
Anyways, you can learn about the catalog api here:
Feel free to ask me any questions if you have any!