Why do you need to use the API? Just use #game.Players:GetPlayers()
and use MessagingService to run that code on each server, then add the numbers up…
They’re looking for the total number of players in-game in all servers
How would I make it only return the player count instead of all of the other data?
I know that… What do you mean?
I thought roblox removed proxy?
No, rprxy just got shut down because they couldn’t host it anymore. Now you can just use rprxy.deta.dev/api/
I can’t remember whether .data is automatically passed as .body but it should look something like this:
local decodedBody = httpService:JSONDecode(proxy:Get('https://games.roblox.com/v1/games?universeIds=100').body)
local active = decodedBody.data[1].playing
if that errors, it’s
active = decodedBody[1].playing
Im not sure if im explaining this right, but when you add “print(decodedBody.data)” it returns a bunch of other things like the games description, max server size, and a bunch of other things
#players:GetPlayers() returns the amount of players in one specific server
Why would you need this though? You just need the amount of players like you said…
There isn’t an API endpoint that specifically returns the amount of players in-game, you have to use the /games/ endpoint to get the amount of players in all servers.
I literally just said how to do it…
I’m not sure I understand. You said to use rprxy.deta.dev which is a public proxy, op wants to use a private one.
I did not say to use a proxy? What do you mean?
I’m confused. You said to use #players:GetPlayers() or to use rprxy.deta.dev, both of which aren’t going to give the op what they want since there is no service that allows people to get the amount of players in all servers.
#players:GetPlayers() returns the amount of players in one specific server; the server in which the code is ran.
Yeah, I said to run that code on every server using MessagingService and then add the numbers up…
I did not say to use it, I was just telling someone about a replacement for rprxy.
Oh okay, I see. MessagingService isn’t as reliable as using a proxy since subscribing can fail, same with publishing. If a request to the proxy fails, you can try again a few minutes later. MessagingService also acts as a service to send data between servers, there’s no “cloud” that hosts the amount of players in the server unless you’re using datastore service, then you’re going to reach your budget very quickly with players leaving and joining constantly.
You can send the info back to the original server with MessagingService.
It’s still not good practice, especially when you have APIs that exist for this purpose