So i was playing island royal and my ping was rlly high and kyu_t said its because we are in a au server, so i was wonder if anyone knew how to know hats server region you are playing in when you join a game,oh yeah i live in georgia
The following thread may have the answer you’re looking for:
Here, I made a function that gets the IP of the server, then gets the Geo location of the server. Make sure to have HTTP requests enabled. this will return a tuple. The results are for example: 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
This post was flagged by the community and is temporarily hidden.
apparently LOL I just found out
Thank you so much,this is amazing
How do you use this to get an EU server and where exactly do you put it to join that server? Say if I want to join a Germany server in Arsenal for example. Where would I put the code and how do I join? I have absolutely zero experience in code so bear with me.
Alright so HTTP service only works on the server, meaning you can’t run the code on any game yourself. This would have to be implemented by the devs of Arsenal. All that code up there does is tell what country/region the Roblox server is in.