How to get a Server Location/Region on Roblox

Currently ip-api is free to use. I don’t know if I should get the priced version instead. We have a sizeable game and making a request on server creation sometimes does fail. Should I buy the 13.99 version instead?

Also with the rapid API one, it doesn’t return the correct location if I have a VPN on, whereas ip-api does.

It works completely right with VPN, a VPN will also affect the Roblox server location so you are getting a different server, however, I don’t own the API.

The ip-API is no longer free to use, unfortunately.

Very useful guide, thank you for updating it.
Although I do have a problem; rapidapi doesn’t give me any information about the city, it just returns nil for that specific value. It isn’t a huge issue (I’m just using the timezone instead) but I am curious if anyone else has a similar problem and if they managed to fix it.

1 Like

I thought North Korea doesn’t play roblox :skull: lol

2 Likes

Is this still relevant? I’ve been trying to activate it, but it keeps returning 403 (Forbidden) and I’ve tried to reiterate it through a loop however it’s still returning the same thing.

1 Like

It occurs when your API key is entered wrong or when you are not firing the API correctly, please recheck your script.

1 Like

I’ve just tried to reuse your sample script and it does not print out the country. The API key is correct from what I know and so is the rapid api key.

EDIT: Sorry for the confusion-- I wasn’t subscribed

1 Like

being a builder and trying to understand what is going on and trying to get this in my game is very hard.
first i have no idea where do i even put this script. i made my acc in the https://rapidapi.com website and it works there now how do i get the info to my game and also display it?
saw a person say to make a gui and then text label and in it a local script but what now? since my experience is basically 0 and can only read a script how do i go from here?

Head over the URL mentioned in the OP and then click on “Subscribe to test”, and then you get your details in the right-side code example, it might be node.js or any language, but it’s easy to read as the labels and their value is needed, which can be easily read from the code. or you can scroll down and read the parameters and you will get the values.

And after you get the values, you can simply check the code example, it would be hard to explain how to code here, because you need to know the basics in order for you to understand the code. But what it does is, it calls the API and then it will show the data in it simply.

1 Like

I don’t even know how to make a text label show the stuff😭 and to get the info from a website to a code it just insane for me

1 Like

you could have used RequestAsync because it doesnt error and you dont have to wrap it around pcall

1 Like


doesnt seem to work anymore man, and my code does nothing

Use “https://ipconfig.io/json” for getting location. it returns json code that you can access just like the tutorial, no api key required

(TESTED)(IN STUDIO)

local HttpService = game:GetService("HttpService")

pcall(function()
    local response = HttpService:GetAsync("https://ipconfig.io/json")
    if response then
        local decodedResponse = HttpService:JSONDecode(response)
        print(decodedResponse["country"])
    else
        print("Failed to fetch data")
    end
end)

That api doesnt give as much info as the last api the OP posted but its still enough for a server display. Theres a ton of different formats but sticking with JSON would be wise.

4 Likes

this was actually the first thing i used and it didnt work, it printed out my location in studio, but not ingame

1 Like

Sometimes, the API fails to respond or the IP cannot be detected by the IPT framework of that host service, then the following will return “” or empty. This isn’t your script issue, it’s the host service or IPR or IP issue.

when i click on the hyperlink that takes me to rapidapi.com, it shows a blank canvas

1 Like

I’m pretty sure, the URL it redirects you is the API Page shown above. Make sure any VPN or any extension that blocks content on the website is disabled - the black canvas is most probably a result of the webpage not loading.

i tried it on my phone too and the same result.

1 Like

made a video using this post
(yes i credited the OP)

2 Likes

https://ipconfig.io/json is either temporarily or permanently down and the server does not respond. There are alternatives online

1 Like