I am trying to utilize HTTP requests however for an unknown reason nothing works anymore, in the past my code functioned perfectly but now I cannot do anything involving HTTP requests.
All of the above result in errors, such as not being allowed to access said information or resulting in an invalid redirect. I tried making a proxy of my own; however, it still failed. The code below results in “Failed to fetch because unable to fetch”
No matter what I do, I am completely unable to use HTTP requests. Everything that previously worked has failed, and anything I create now also fails. I have tried asking for help everywhere, but no one seems to be able to help me. How do I use HTTP requests?
I am honestly about ready to give up at this point so any help would be appreciated.
I’ve done stuff like this in the past, I hope I’ll be able to help you.
Firstly, using HttpService to get data from the Roblox website in-game is not allowed and thus you would need a proxy.
I love that you’re using Google App Scripts; I’ve used that too for stuff like this. Whenever fetching data in a Google App Script, you need to pass in a Roblox cookie in to the header. This is for security purposes. You can use some default cookies to get around this.
Keep in mind that I suggest you try first finding a site like RoProxy.com to handle the requests as there is no rate limit (Google App Scripts is usually 20,000 requests/day).
I was initially using already existing proxies like roproxy, but that seem to no longer work, so I attempted to make my own; however, I used a tutorial to do so.
create a table named options which has a method, headers, and mutehttpexceptions. the headers will be another variable that has a cookie and user agent. Then pass this in to the 2nd arugment of UrlFetchApp.fetch(). Look at my code and follow along if you need help because it is meant for Roblox!
Look I am extremely new to this, the rate limits are not even an issue, can I just get help with something simple to start off with, how would I get the amount of active players in a game from the game id for example? If I must make my own proxy to do this I will attempt to figure this stuff out but I would greatly appreciate if there was a simple in studio solution.
Yeah so you can easily get the amount of players in a game. But you cannot use the PlaceId but rather the UniverseId. Remember that each universe (“game”) can have multiple places within it.
Just type this into your browser (this is just a one-time thing): https://apis.roblox.com/universes/v1/places/{placeId}/universe
Example of what it returns:
Now the URL that you will use for your App Script is: https://games.roblox.com/v1/games?universeIds={universeId}