Roblox: How to Check Server Region You are Playing in

If you are coming here because you are looking for a way to check the Roblox server region that you are playing in, you are in the right place as you will get the information here. Please read the information well and understand every single word.

Just like you, a lot of people also have been wondering about how to check the server region that they are playing in. They have posted this question on communities. One of the communities where you can find such questions is DevForum.

Roblox- How to Check Server Region You are Playing in

As the response to the question, Ze_tsu shared an answer to the question from one of Roblox developers that says that it is currently too hard to accurately get the hosting location of a Roblox server that is being played on. If this kind of thing exists, the developers will be allowed to do a lot of different things, such as improve matchmaking through use of prioritizing servers closer to the user or even having specific builds or GUIs cater to the user in single player games.

Aye_Jay said that there is no built in way to do this. The way people do this is they send HTTP GET requests to a URL which is able to find the general location for a server. Actually, this feature is not recommended as it quite literally does nothing but give you the state of a Roblox server at best. Besides, he found a post that suggests using a simple web service to retrieve information about the server. According to the suggestion, you can just send a HTTP GET request to this URL: http://ip-api.com/json/. By clicking on the link, you will be given with enough details. However, it should be noted that it is not always very accurate. For instance, it can say Nevada for some servers while in fact Roblox does not rent any servers in Nevada.

Besides, there is also a programmer named AC_Starmarine. He said he made a function that gets the IP of the server and then gets the Geo location of the server. If you want to try it, you will have to make sure to have the HTTP requests enabled to make it return a tuple. For example, the result is FL, Florida.

function GetServerRegion()

               local http = game:GetService(“HttpService”)

 

               local result

              

               local g,b = pcall(function()

                              result = http:JSONDecode(http:GetAsync(“https://api4.my-ip.io/ip.json”))

               end)

 

               local ip = result.ip

              

               if g and ip then

                              local location

                              local good,bad = pcall(function()

                                             location = http:JSONDecode(http:GetAsync(“http://ip-api.com/json/”..ip))

                              end)

                              if good and location.region and location.regionName then

                                             return location.region , location.regionName

                              else

                                             warn(“fatal error fetching server geo location. error: “..bad)

                                             return nil, nil

                              end

               else

                              warn(“fatal error fetching server ip. error: “..b)

                              return nil, nil

               end

end

 

Unfortunately, there is no exact answer of how to check the Roblox server region that you are playing in provided by Roblox and the only one that can be found is opinion from the members of the community. Go visit the community if you want to discuss it with the members.

Talking about Roblox and server location, you might also need the information about how to get a server location in Roblox. If you are interested in this information, please keep reading the post until the end.

As you probably know, a few games have server location displays. By reading this following guide, you will be able to make it:

    1. The first thing that you have to do is to enable https requests in your game.
    2. After enabling it, go to http://ip-api.com/json/. By clicking on the link, you will be able to get the location and all info.
    3. Now, it is time for you to make Roblox serve to open that link. Before anything, it should be noted that the info that you get in the link is an API and is a JSON table and it will be needed for you to make it Lua table by using a https function. To be able to do that here is how:

local url = “http://ip-api.com/json/”

local httpsservice = game:GetService(“HttpService”)

 

game.Players.PlayerAdded:Connect(function(plr)

    wait(2) — player loads fully

    local getasyncinfo = httpsservice:GetAsync(url) — roblox server will get info from that link, this will be in JSON format

    local decodedinfo = https:JSONDecode(getasyncinfo) — make the table into lua table, so its easy to read it

    game.Workspace.ServerLocation.Value = “Server Location: “..decodedinfo[“country”] — 31 – 37 is is the country name in 5 words

end)

               Here is everything in the decoded table:

               local table = {

                    [“as”] = “Internet Name”,

                    [“city”] = “###”,

                    [“country”] = “####”,

                    [“countryCode”] = “#”,

                    [“isp”] = “###”,

                    [“lat”] = ###, — number

                    [“lon”] = 78.50749999999999,

                    [“org”] = “###”,

                    [“query”] = “###”,

                    [“region”] = “###”,

                    [“regionName”] = “###”,

                    [“status”] = “success”,

                    [“timezone”] = “###”,

                    [“zip”] = ### – number

}

print(table[“city”]) — prints city

If you are confused here is the explanation to check out. Basically, the first player who joined the server, the server location will be the player location. In short, you make a script that gets this location. It is the same as getting your location after clicking the API. Apparently, this script will be the one clicking the API, so it gets its location and then the function string. sub can be used to get a specific part of the string. the info you see in the API may look like a table when in fact it is a string.

Everything below is important in case the https service is not enabled or the link is not pasted well or any other error can break this server location script. If you want to get a better version of this script, you can try the following script:

local url = “http://ip-api.com/json/”

local httpsservice = game:GetService(“HttpService”)

 

game.Players.PlayerAdded:Connect(function(plr)

    local success,errormessage = pcall(funtion() — the script won’t stop working at a line if its inside a pcall function

    wait(2) — player loads fully

    local getasyncinfo = httpsservice:GetAsync(url) — roblox server will get info from that link

    game.Workspace.ServerLocation.Value = “Server Location: “..string.sub(tostring(getasyncinfo),31,37) — 31 – 37 is is the country name in 5 words

  end)

  if errormessage ~= nil then — if its not success script, it will print the error

     print(errormessage)

  end

end)