API Grabber - Get Live Game Stats Without an External Proxy or Messaging Service

This resource is a little too specific to put into #resources:community-resources, but I still wanted to post this in case anyone ever needs something like it in the future. I also think it’s pretty cool.

Why

Recently, I wanted to make a live updating counter of visits / playing for my game. As you can’t use HttpService with Roblox endpoints directly from a Roblox Server, there’s only two options:

  • Host your own or use someone else’s proxy server
  • Use MessagingService across multiple servers

The issue with a proxy is that it can be unreliable, and unscalable if your game gains a playerbase overnight. MessagingService doesn’t work either as the current limitations are quite restricting, and subject to change at any time. Both theses solutions lack scalability.


The Solution

The solution I’ve come up with is using a GitHub Action to constantly poll to these APIs, and then push the fetched data into a repository.

Here’s what a successful run looks like:

Then, I can just get the raw content url, like https://raw.githubusercontent.com/ThatTimothy/live-stats/main/stats/roblox-uno.json, from a Roblox Server using GetAsync. Additionally, since GitHub has version control, I can also get historical data as well!


Setup

If you’d like to do this on your own, all you have to do is add this GitHub Action to a new repository, and configure your workflow to automatically use it.

Here’s a public repository with the workflow and examples already set up that you can clone for your own usage:

Additionally, if you just need the stats of the top games of Roblox, you can just use https://raw.githubusercontent.com/ThatTimothy/live-stats/main/raw-popular-data.json.


Conclusion

If you have any questions, feel free to ask. If you want your own game on the list I can also easily add that as well. I’m mainly posting this because I’ve seen people ask how to do this without a proxy or messaging service before, and hopefully this can find those people.

4 Likes