Get Players In a Server via HTTP Requests?

Is it possible to get a list of players in a server via one of Roblox’s API endpoints?

I found this, but I don’t think any of them give specific information beyond the player count per server.
Any help is appreciated.

local playersService = game:GetService("Players")
local listOfPlayers = playersService:GetPlayers()

More info here.

Using the Roblox HTTP API, not Lua. But thanks.
CC: @RontheDragon204

That gets all the players in the server though? If you want something else you should probably clarify.

I meant via a POST/GET request using Roblox’s API.
That’s for getting in-game players.

I’ll edit my post to clarify.

I found this, and inside the response json data, you will get a list of servers and the currently playing player count, unfortunately not a list of actual players. I don’t think there is an actual API for this

2 Likes

Thanks. I’ll mark this as the solution if nobody else is able to find anything.

I’m looking for the actual username’s of the people playing, not the amount.
But thanks.

Roblox hasn’t allowed users to know the specific usernames of players currently in servers since somewhere around 2015, maybe even longer ago. There was a time where you could mouse over a player’s thumbnail and it’d display their username, but that’s since long gone.

The only way to tell if a specific user is in a specific server is if you’re their friend and they have their follows on or if you own the game and internally gather the information yourself from the game server.

3 Likes

Yeah, but I was hopeful since Roblox’s API does give you access to information like a list of servers with FPS and ping without joining.

There is a way to do what you’re looking for, but you need quite a bit of information pre-emptively before attempting it – and even then, I’d estimate this only works around half of the time, at best:

You need a target user and the game they’re in.

First, you gather all servers of the game you’re targeting, as well as the thumbnail of the user you’re targeting. Using the data gathered from the games API, user thumbnails are returned in each server’s JSON – you can parse through those thumbnails to return a thumbnail that’s corresponding to the hash given to you by the thumbnail of the user.

I must note, however; this is seldomly correct unless a user is wearing an extremely unique outfit, as outfit thumbnail hashes are based on the combination of the items in the outfit, and aren’t directly attached to the user.

A very hacky and guessing way to bypass safety precautious via data scraping, but I’ve found some success with it. I suggest taking all results with a grain of salt.

Have fun!

1 Like

That’s an extremely creative method I never thought of, thanks.
Since it’s my own game, I ended up just sending a POST request to my own server with a list of all the player’s in-game.

The best thing to do is to tell your Roblox server to send the active-players, perhaps on join/leave so you don’t need to spam HTTP Requests. An example:

game.Players.PlayerAdded:Connect(function(plr)
game.HTTTPService:GetAsync("https://yourwebsite.com/join?user="..plr.UserId)// for sake of simplicity, I request using a post request
end)
game.Players.PlayerRemoving:Connect(function(plr)
game.HTTTPService:GetAsync("https://yourwebsite.com/leave?user="..plr.UserId)// for sake of simplicity, I request using a post request
end)

This is the only way to keep track of the players in your games with accurate data.

Adding on to what sloss2003 said, basically, you can just do this

local plrs = game:GetService("Players"):GetPlayers()
game:GetService("HttpService"):GetAsync("https://site/players?plrs=" .. plrs)
1 Like