How to get server info from a roblox place in 2024+!

Hey everyone! So I’ve been working on a Roblox game for the past couple days and I’ve been getting stuck on the part where players can view a server list of a specific place!

I’ve searched everywhere and found nothing as this topic has honestly never been covered recently, everything related to this is just out-dated.

Anyway! In this post I’m gonna be showing you how you yourself can actually get server data using your very own PROXY!!!

Firstly, Creating the Proxy.

Now this is actually hard at all and only takes a couple steps, and the best thing about it. IT’S FREE!
Let’s get started…

Firstly, go to Google Drive and press the big CREATE button at the top left.
image

Afterwards, you’ll see a drop down menu, Click on the more button at the button, then the option that says “Google Apps Script”

Afterwards, it’ll create a new App script and once it has fully loaded you should see a screen like this:

Now, paste this code into the text input!

function doGet(e) {
  var output;
  try
  {
    var query = e.parameter["q"];
    var response = UrlFetchApp.fetch(decodeURIComponent(query));
    output = {"result":"success", "response": JSON.parse(response.getContentText())};
  }
  catch(e)
  {
    output = {"result":"error", "error": "Unable to fetch"};
  }
  return ContentService.createTextOutput(JSON.stringify(output)).setMimeType(ContentService.MimeType.JSON);
}

Now that you have done that, Edit your project name if you want, after that press the Deploy button

Once done, you’ll see a drop down menu, press on the “New Deployment” option.
After that, you’ll see a pop up, press on the gear icon at the top left
image

Once done, select the “Web App” option.
Once done, it’ll show up new options on the same pop up, Fill in the description and find the “Who Has Access” part, change this to “Anyone”. THIS IS VERY IMPORTANT! IF YOU DON’T DO THIS THE PROXY WON’T WORK!

Once done, press the Deploy button at the bottom right and your done with your proxy!!!
Let it load for a bit and then the pop up will show 2 things, Don’t worry about the App URL, just copy the Deployment ID and save it somewhere (like a string value in SSS or something.)

Now, once your Proxy is set up and done. Let’s use it now!!!

To get any sorta data, in this case server info. Create a server script and paste in the following code:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local HttpService = game:GetService("HttpService")

local ID = script:WaitForChild("ProxyID").Value --You know that Deployment ID you saved somewhere? Paste it into this "ProxyID" string value.

local Url = "https://script.google.com/macros/s/" .. ID .. "/exec"

function JSONDecode(JSON)
	local success, result = pcall(function()
		return HttpService:JSONDecode(JSON)
	end)
	if success then
		return result
	else
		warn("Failed to decode JSON: " .. tostring(result))
		return {}
	end
end

local function getServerData()
	local endpoint = "PASTE IN YOUR END POINT HERE!"

	local JSON = HttpService:GetAsync(Url .. "?q=" .. HttpService:UrlEncode(endpoint))
	local result = JSONDecode(JSON)

	if result.result == "success" then
		return result.response.data
	else
		warn(endpoint .. " failed to fetch because " .. tostring(result.error))
		return nil
	end
end

--then just call that getServerData function and done!

So to set up everything, create a new string value instance in your server script and call it “ProxyID”
Once done, paste your Deployment ID in the value input.

Remember, have this script in server script service so no one can get access to it!

After you’ve done that, paste your endpoint, in our case since we are finding server data, paste in the following:

local endpoint = "https://games.roblox.com/v1/games/" .. serverID .. "/servers/Public?sortOrder=Asc&limit=100"

Just make the serverID part the placeID of the place you are trying to get the data from.

After that, YOU ARE DONE!
IT is that simple…

And also, if you wanna see what data you are really getting, right above your “return result.response.data” line in your server script, make a new line and enter: “print(JSON)”
This will just print out all of the data.

REMEMBER: Using proxy related things are a big risk sometimes as exploiters can possibly gain access to the proxy ID (Deployment ID) and abuse it, so remember to keep anything proxy related on the server side and don’t give that proxy ID to ANYONE!

Anyway, thank you for reading this post! I hope I helped you out!!! If you ahve any questions, please let me know down below!!

Have fun developing!!!

4 Likes

The endpoint used to retrieve your game’s active servers can only fetch so much information at once. Roblox uses pagination on this endpoint, so you’ll need to check for a next page cursor to ensure no data is missed. If the cursor is present, you’ll have to set it as a parameter in your URL, query the endpoint again, and repeat this process until all servers are fetched. You can take the generator approach and only retrieve the next set of servers when asked by the client. Given some time, though, the previous servers may be out-of-date, so you may need to fetch all servers from Pg. 1 -> Pg. n + 1

2 Likes

Correct! I am not exactly covering all of that in this post. Just covering how you could overall retrieve server data or any data from Roblox in general (that’s available).

If you wanna continue on the post with more info about this, please do! I’m sure it’d help tons of people!

Theres an misspell:

Note the italic bold texts
Please refine your English

1 Like