Sending game stats

Block Evolution Studios (studio behind Heists and Heists 2 and much more.)
Made something like this:

I asked, how did they do it and the response was:

image

So I want to ask, how to do it? Thanks for any response. :slight_smile:

2 Likes

Since they mentioned a Roblox bot account I figure they’re using the website API. The main documentation page for the games API will likely prove useful to you. From the reading I did /v1/games should give you the total player count for the universe given you have the universe id. This specific endpoint is available anonymously so you don’t have to login to Roblox to view it.

I highly suggest you look at the rest of the documentation I gave to see if there is anything else more relevant to your needs.

If you want to call to your own web API from within a Roblox server with the player count in game you can do this too, just use HttpService.

Okay, thanks. And what do you mean by this?[quote=“NovusTheory, post:2, topic:390167”]
If you want to call to your own web API from within a Roblox server with the player count in game you can do this too, just use HttpService.
[/quote]

Like sending the number from actual Server Script?

But how?

Okay, I’ve made an example script. And when doing this:

fetch('https://games.roblox.com/v2/games/383310974/media')
.then(res => res.json())
.then(posts => console.log(posts))

it errors this:

[Error] Origin null is not allowed by Access-Control-Allow-Origin.
[Error] Fetch API cannot load https://games.roblox.com/v2/games/383310974/media due to access control checks.
[Error] Failed to load resource: Origin null is not allowed by Access-Control-Allow-Origin. (media, line 0)
[Error] Unhandled Promise Rejection: TypeError: Origin null is not allowed by Access-Control-Allow-Origin.

I’m not that well-versed in this, but as far as I know, you have to get certain tokens, authenticate with the dummy account in order for you to pass all the checks, though, not too sure about Access-Control-Allow-Origin, you may need to fiddle with your Headers a little bit.

EDIT:
Yea, you have to specify it in your headers table. like Access-Control-Allow-Origin: * might work, check this article out I found: Access-Control-Allow-Origin - HTTP | MDN

1 Like