(SOLVED) How do I make a script that teleports specific languages to another game?

I want to make a game that has people non-speaking English to a version of the game of their own selected language.

I just want to make a game that you can meet people in, like a hangout or something.

Anything that can show what language they’re in?

1 Like

You could do this using the LocalizationService (LocalizationService | Documentation - Roblox Creator Hub).

Specifically, using the GetCountryRegionForPlayerAsync function.

2 Likes

Is there a table for all of the Country Regions?

Yes, there are plenty you may find online.

Here’s one I found through google: Language Codes

Please note that GetCountryRegionForPlayerAsync returns the region in uppercase. You might want to :lower() the string returned if you convert the table by lower case.

1 Like

I’ve finished it, put it in a local script.

print(game:GetService(“LocalizationService”):GetCountryRegionForPlayerAsync(game.Players.LocalPlayer))

if game:GetService(“LocalizationService”):GetCountryRegionForPlayerAsync(game.Players.LocalPlayer):lower() == “us” or game:GetService(“LocalizationService”):GetCountryRegionForPlayerAsync(game.Players.LocalPlayer):lower() == “gb” or game:GetService(“LocalizationService”):GetCountryRegionForPlayerAsync(game.Players.LocalPlayer):lower() == “ca” or game:GetService(“LocalizationService”):GetCountryRegionForPlayerAsync(game.Players.LocalPlayer):lower() == “in” or game:GetService(“LocalizationService”):GetCountryRegionForPlayerAsync(game.Players.LocalPlayer):lower() == “au” then

print(“English”)

else

print(“Non-English, send to non-English server.”)

end

Please don’t use this method for checking what language someone speaks. There’s a property for this under LocalizationService called RobloxLocaleId. Alternatively, the user’s system language will be under LocalizationService.SystemLocaleId. You can just check if it starts with en like this:

local client = game:GetService("Players").LocalPlayer
local localizationService = game:GetService("LocalizationService")

if localizationService.RobloxLocaleId:sub(1,2) == "en" then
 	-- just check if it starts with en since there's lots...
	-- ...of codes for english (en, en-us, en-tt, en-za)
	print("English")
else
	print("Non-english")
end

You might also want to read this @MetatableIndex

7 Likes