So, I found a slight solution. It’s definitely not perfect, but more players are getting less lag, and the ping has improved by a lot.
Could this script be better? Probably. But I’m lazy, so I simply got an AI to fill in the countries according to their continent/region and fill in the place id on a table.
If anyone is also having this issue and wants to use this, you can probably give ChatGPT this script and fill in the Place IDs for you instead of having to do it manually.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
local LocalizationService = game:GetService("LocalizationService")
local countryCodes = {
US = 15573797306, -- North/South America
GB = 15573796351, -- United Kingdom
CA = 15573797306, -- Canada
AF = 15597287950, -- Afghanistan
AX = 15597287950, -- Aland Islands
AL = 15597287950, -- Albania
DZ = 15597287950, -- Algeria
AS = 15597287950, -- American Samoa
AD = 15597287950, -- Andorra
AO = 15597287950, -- Angola
AI = 15597287950, -- Anguilla
AQ = 15597287950, -- Antarctica
AG = 15597287950, -- Antigua and Barbuda
AR = 15597287950, -- Argentina
AM = 15597287950, -- Armenia
AW = 15597287950, -- Aruba
AU = 15597289462, -- Australia/Oceania
AT = 15573796351, -- Austria
AZ = 15597287950, -- Azerbaijan
BS = 15573797306, -- Bahamas
BH = 15597287950, -- Bahrain
BD = 15597287950, -- Bangladesh
BB = 15597287950, -- Barbados
BY = 15573799206, -- Belarus
BE = 15597287950, -- Belgium
BZ = 15597287950, -- Belize
BJ = 15597287950, -- Benin
BM = 15597287950, -- Bermuda
BT = 15597287950, -- Bhutan
BO = 15597287950, -- Bolivia
BQ = 15597287950, -- Bonaire, Saint Eustatius and Saba
BA = 15597287950, -- Bosnia and Herzegovina
BW = 15597287950, -- Botswana
BV = 15597287950, -- Bouvet Island
BR = 15597287950, -- Brazil
IO = 15597287950, -- British Indian Ocean Territory
BN = 15597287950, -- Brunei Darussalam
BG = 15597287950, -- Bulgaria
BF = 15597287950, -- Burkina Faso
BI = 15597287950, -- Burundi
KH = 15597287950, -- Cambodia
CM = 15597287950, -- Cameroon
CV = 15597287950, -- Cape Verde
KY = 15597287950, -- Cayman Islands
CF = 15597287950, -- Central African Republic
TD = 15597287950, -- Chad
CL = 15597287950, -- Chile
CN = 15597287950, -- China
CX = 15597287950, -- Christmas Island
CC = 15597287950, -- Cocos Islands
CO = 15597287950, -- Colombia
KM = 15597287950, -- Comoros
CG = 15597287950, -- Congo
CD = 15597287950, -- Congo (DRC)
CK = 15597287950, -- Cook Islands
CR = 15597287950, -- Costa Rica
CI = 15597287950, -- Ivory Coast
HR = 15597287950, -- Croatia
CW = 15597287950, -- Curaçao
CY = 15597287950, -- Cyprus
CZ = 15597287950, -- Czech Republic
DK = 15597287950, -- Denmark
DJ = 15597287950, -- Djibouti
DM = 15597287950, -- Dominica
DO = 15597287950, -- Dominican Republic
EC = 15597287950, -- Ecuador
EG = 15597287950, -- Egypt
SV = 15597287950, -- El Salvador
GQ = 15597287950, -- Equatorial Guinea
ER = 15597287950, -- Eritrea
EE = 15597287950, -- Estonia
ET = 15597287950, -- Ethiopia
FK = 15597287950, -- Falkland Islands (Malvinas)
FO = 15597287950, -- Faroe Islands
FJ = 15597287950, -- Fiji
FI = 15597287950, -- Finland
FR = 15597287950, -- France
GF = 15597287950, -- French Guiana
PF = 15597287950, -- French Polynesia
TF = 15597287950, -- French Southern Territories
GA = 15597287950, -- Gabon
GM = 15597287950, -- Gambia
GE = 15597287950, -- Georgia
DE = 15597287950, -- Germany
GH = 15597287950, -- Ghana
GI = 15597287950, -- Gibraltar
GR = 15597287950, -- Greece
GL = 15597287950, -- Greenland
GD = 15597287950, -- Grenada
GP = 15597287950, -- Guadeloupe
GU = 15597287950, -- Guam
GT = 15597287950, -- Guatemala
GG = 15597287950, -- Guernsey
GN = 15597287950, -- Guinea
GW = 15597287950, -- Guinea-Bissau
GY = 15597287950, -- Guyana
HT = 15597287950, -- Haiti
HM = 15597287950, -- Heard Island and the McDonald Islands
VA = 15597287950, -- Holy See
HN = 15597287950, -- Honduras
HK = 15597287950, -- Hong Kong
HU = 15597287950, -- Hungary
IS = 15597287950, -- Iceland
IN = 15597287950, -- India
ID = 15597287950, -- Indonesia
IQ = 15597287950, -- Iraq
IE = 15597287950, -- Ireland
IM = 15597287950, -- Isle of Man
IL = 15597287950, -- Israel
IT = 15597287950, -- Italy
JM = 15597287950, -- Jamaica
JP = 15597287950, -- Japan
JE = 15597287950, -- Jersey
JO = 15597287950, -- Jordan
KZ = 15573799206, -- Kazakhstan
KE = 15597287950, -- Kenya
KI = 15597287950, -- Kiribati
KR = 15597287950, -- Korea
KW = 15597287950, -- Kuwait
KG = 15573799206, -- Kyrgyzstan
LA = 15597287950, -- Laos
LV = 15597287950, -- Latvia
LB = 15597287950, -- Lebanon
LS = 15597287950, -- Lesotho
LR = 15597287950, -- Liberia
LY = 15597287950, -- Libya
LI = 15597287950, -- Liechtenstein
LT = 15597287950, -- Lithuania
LU = 15597287950, -- Luxembourg
MO = 15597287950, -- Macao
MK = 15597287950, -- Macedonia
MG = 15597287950, -- Madagascar
MW = 15597287950, -- Malawi
MY = 15597287950, -- Malaysia
MV = 15597287950, -- Maldives
ML = 15597287950, -- Mali
MT = 15597287950, -- Malta
MH = 15597287950, -- Marshall Islands
MQ = 15597287950, -- Martinique
MR = 15597287950, -- Mauritania
MU = 15597287950, -- Mauritius
YT = 15597287950, -- Mayotte
MX = 15597287950, -- Mexico
FM = 15597287950, -- Micronesia
MD = 15597287950, -- Moldova
MC = 15597287950, -- Monaco
MN = 15597287950, -- Mongolia
ME = 15597287950, -- Montenegro
MS = 15597287950, -- Montserrat
MA = 15597287950, -- Morocco
MZ = 15597287950, -- Mozambique
MM = 15597287950, -- Myanmar
NA = 15597287950, -- Namibia
NR = 15597287950, -- Nauru
NP = 15597287950, -- Nepal
NL = 15597287950, -- Netherlands
AN = 15597287950, -- Netherlands Antilles
NC = 15597287950, -- New Caledonia
NZ = 15597287950, -- New Zealand
NI = 15597287950, -- Nicaragua
NE = 15597287950, -- can't say that
NG = 15597287950, -- also can't say this
NU = 15597287950, -- Niue
NF = 15597287950, -- Norfolk Island
MP = 15597287950, -- Northern Mariana Islands
NO = 15597287950, -- Norway
OM = 15597287950, -- Oman
PK = 15597287950, -- Pakistan
PW = 15597287950, -- Palau
PS = 15597287950, -- Palestine
PA = 15597287950, -- Panama
PG = 15597287950, -- Papua New Guinea
PY = 15597287950, -- Paraguay
PE = 15597287950, -- Peru
PH = 15597287950, -- Philippines
PN = 15597287950, -- Pitcairn Islands
PL = 15597287950, -- Poland
PT = 15597287950, -- Portugal
PR = 15597287950, -- Puerto Rico
QA = 15597287950, -- Qatar
RE = 15597287950, -- Reunion
RO = 15597287950, -- Romania
RU = 15573799206, -- Russian Federation
RW = 15597287950, -- Rwanda
BL = 15597287950, -- Saint Barthelemy
SH = 15597287950, -- Saint Helena, Ascension and Tristan da Cunha
KN = 15597287950, -- Saint Kitts and Nevis
LC = 15597287950, -- Saint Lucia
MF = 15597287950, -- Saint Martin
PM = 15597287950, -- Saint Pierre and Miquelon
VC = 15597287950, -- Saint Vincent and the Grenadines
WS = 15597287950, -- Samoa
SM = 15597287950, -- San Marino
ST = 15597287950, -- Sao Tome and Principe
SA = 15597287950, -- Saudi Arabia
SN = 15597287950, -- Senegal
RS = 15597287950, -- Serbia
SC = 15597287950, -- Seychelles
SL = 15597287950, -- Sierra Leone
SG = 15597287950, -- Singapore
SX = 15597287950, -- Sint Maarten
SK = 15597287950, -- Slovakia
SI = 15597287950, -- Slovenia
SB = 15597287950, -- Solomon Islands
SO = 15597287950, -- Somalia
ZA = 15597287950, -- South Africa
GS = 15597287950, -- South Georgia and the South Sandwich Islands
SS = 15597287950, -- South Sudan
ES = 15597287950, -- Spain
LK = 15597287950, -- Sri Lanka
SR = 15597287950, -- Suriname
SJ = 15597287950, -- Svalbard and Jan Mayen
SZ = 15597287950, -- Swaziland
SE = 15597287950, -- Sweden
CH = 15597287950, -- Switzerland
TW = 15597287950, -- Taiwan
TJ = 15597287950, -- Tajikistan
TZ = 15597287950, -- Tanzania
TH = 15597287950, -- Thailand
TL = 15597287950, -- Timor-Leste
TG = 15597287950, -- Togo
TK = 15597287950, -- Tokelau
TO = 15597287950, -- Tonga
TT = 15597287950, -- Trinidad and Tobago
TN = 15597287950, -- Tunisia
TR = 15597287950, -- Turkey
TM = 15597287950, -- Turkmenistan
TC = 15597287950, -- Turks and Caicos Islands
TV = 15597287950, -- Tuvalu
UG = 15597287950, -- Uganda
UA = 15597287950, -- Ukraine
AE = 15597287950, -- United Arab Emirates
UM = 15597287950, -- United States Minor Outlying Islands
UY = 15597287950, -- Uruguay
UZ = 15597287950, -- Uzbekistan
VU = 15597287950, -- Vanuatu
VE = 15597287950, -- Venezuela
VN = 15597287950, -- Vietnam
VG = 15597287950, -- Virgin Islands (British)
VI = 15597287950, -- Virgin Islands (US)
WF = 15597287950, -- Wallis and Futuna
EH = 15597287950, -- Western Sahara
YE = 15597287950, -- Yemen
ZM = 15597287950, -- Zambia
ZW = 15597287950, -- Zimbabwe
CU = 15597287950, -- Cuba
IR = 15597287950, -- Iran
SY = 15597287950, -- Syria
KP = 15597287950 -- North Korea
}
local function FindRegion()
local player = Players.LocalPlayer
local success, countryCode = pcall(LocalizationService.GetCountryRegionForPlayerAsync, LocalizationService, player)
if success then
print("Country Code:", countryCode)
local placeId = countryCodes[countryCode]
if placeId then
script.Parent.Parent.Status.Text = "Connecting to server for country: " .. countryCode .. "..."
TeleportService:Teleport(placeId)
else
script.Parent.Parent.Status.Text = "Connecting to Global server..."
wait(1)
TeleportService:Teleport(15597512029)
end
else
script.Parent.Parent.Status.Text = "Connecting to Global server..."
wait(1)
TeleportService:Teleport(15597512029)
end
end
script.Parent.MouseButton1Click:Connect(FindRegion)