Getting # of players within a place in a universe

How would I accomplish this?
It would probably utilize HttpService and a proxy/web app of some kind; I don’t know where to start.

rprxy.xyz seems reliable, but if you have the infrastructure budget, you should set up an independent proxy.

2 Likes

You could use DataStores, but what you suggested seems better.

You’d firstly want to set up a rough idea of what you want it to do; maybe grab a piece of paper and pencil and sketch what steps you want it go through.

Usually you’d add/remove a player when they join/leave, send that update to the web app, then what you do from there is up to you. Most of the time it’s just a case of doing a get request every second or so.

Here’s a brief example:

local PlayerData = {NumPlayers = 0}

Players.PlayerAdded:Connect(function(Player)
    local Data = {UserId = player.UserId, Leaving = false}
    -- data to send, userid for adding/removing from a dictionary for example
    Data = HttpService:JSONEncode(Data)
    -- encode to JSON (table -> string) since you can't send tables through HttpService
    HttpService:PostAsync("url",Data)
end)

Players.PlayerRemoving:Connect(function(Player)
    local Data = {UserId = Player.UserId, Leaving = true}
    Data = HttpService:JSONEncode(Data)
    HttpService:PostAsync("url",Data)
end)

while wait(1) do
    PlayerData = HttpService:JSONDecode(HttpService:GetAsync("url"))
    print(PlayerData.NumPlayers)
end

On the web app you’d want to insert/remove values from the data you have there when a post request is called, and on a get request you’d return whatever data you need to use.

You could use Google Spreadsheets, as it’s free and it won’t be much of a handicap unless you are having a lot of players in a single place at once time.

DigitalOcean banned me from their services. Still don’t know how to set a proxy up though and use it to find the # of players.

You could always just make a new account, couldn’t you?

Unless I use a new email.

I made a feature request before that would of made this so easier if happened.

If you only need the amount of players in a place, then that could be found on the roblox site using http services.

I’m pretty sure I answered a question like this before, not sure if it’s exactly what you want but take a look.

You can’t web scrape the # of players in a place within a universe.

1 Like

Is there a web api to get the running servers with the players in the servers? I can just add up the players in them.

Just made a video on this… check it out! https://www.youtube.com/watch?v=2cc7gIXaSkM

I’m not looking for datastores.

your question was “Getting # of players within a place in a universe” that video I linked accomplishes it.

I’m looking for web endpoints that could.

well then there is none.