I have a server list in my game which allows you to join other players. The problem with it is that it displays servers all around the world instead of for the players region only, this causes lag when in that server. Is there a way to get the region to avoid this, and when a server is created, is it’s region always the same or does it change from time to time?
Thats cap
Make an API request to a website
like this:
has to be on server script, not client
is this what you are looking for?
lmk if I’m wrong
{"status":"fail","message":"SSL unavailable for this endpoint, order a key at https://members.ip-api.com/"}
I think that wont work…
may I see your code?
dsaddadasd
There’s no problem with my code. I’m just trying to get the region. Are you sure this link works because I read somewhere that it stopped.
I pasted it into my browser and it works… what abt u?
In my browser it’s just a black page with {"status":"fail","message":"SSL unavailable for this endpoint, order a key at https://members.ip-api.com/"}
huh. that is not whats going on for me… by chance, what region do you live in?
UK
skibidiedgerizzskibidiedgerizz
Hmm. well im in 'mercia so yeah
maybe try to find something similar to that but works in all regions… (u can test with a VPN)
If you read the original post of the article I linked, you will see that Roblox servers no longer provide reliable region information using this method.
It also depends on external API.
Edit:
Also as stated in the response from the Roblox employee, Roblox game servers do not necessarily depend solely on a physical server in a single geographical location.
So there is currently no way to get the server region?
You can use the external API, sure. Just don’t depend on it to be accurate in any form.
edit: you are also at mercy of the provider of the API keeping it alive, so make sure to wrap all requests in protected calls
It says right there that he isn’t a registered user of the API, lol. They probably have a subscription service that grants you a key. This API won’t work for OP unless they pay what I assume is an extreme amount of money every month.
@INotKillz if you intend to use an external API, you’ll more than likely wind up having to pay for it, or you’ll have to find one that offers their API for free.
I just did it… it works… u want code??
just find a different website
Yes please, could you post a screenshot of output to validate that it returns the server region? According to their website, you have to pay.
Please stop providing inaccurate information without verifying it.
Here:
local httpsservice = game:GetService("HttpService")
local url = "http://ip-api.com/json/"
local data = httpsservice:GetAsync(url,false)
local decodeddata = httpsservice:JSONDecode(data)
game.Workspace.DeveloperStats.ServerLocation.Value = "Server Location: "..decodeddata["city"]..", "..decodeddata["country"]