Well, I want that when a player enters the game, the game detects their language to later change the language of the game. I already made a language system (Spanish and English at the moment), but you simply change it with a GUI and I want it to detect the original language of the player in order to make the changes
Here’s a great article about this topic from the wiki.
It’s certainly probably what I need, but I don’t like it as it’s usually not accurate. I made a whole script that translates the game, I just need to detect the language and send to activate the language script
This is what translates languages
local LanguageConfg = {
Spanish = function(player, PlayerAddedOrNot, Profile)
if PlayerAddedOrNot == "PlayerAdded" then
wait(10)
elseif PlayerAddedOrNot == "FireToLoadNow" then
end
local PlayerGui = player:WaitForChild("PlayerGui")
local Menu_De_Mapa = PlayerGui:WaitForChild("MenuDeMapa")
local ViewSelection = Menu_De_Mapa:WaitForChild("Mapa"):WaitForChild("ViewSelection")
local Ajustes = ViewSelection:WaitForChild("Ajustes")
--Controles
local ControlInConfiguration = Ajustes:WaitForChild("Controles")
local BotonesDeControles = ControlInConfiguration:WaitForChild("Botones")
BotonesDeControles.Controles.Text = "Controles"
BotonesDeControles.Teclas.Text = "Teclas"
local ConfiguracionDeControles = ControlInConfiguration:WaitForChild("ControlScroll")
ConfiguracionDeControles.ConfCrouch.Bio.Frame.TextLabel.Text = [[
Decide si quieres presionar solo una vez la tecla de agachado para agacharse, o mantener presionada la tecla para agacharse ("âś”" si quieres mantenerte presionando la tecla; "x" si solo quieres presionar una vez la tecla)
]]
ConfiguracionDeControles.ConfCrouch.Data.Titulo.Text = "Agachado"
ConfiguracionDeControles.ConfSprint.Data.Titulo.Text = "Correr"
local ConfiguracionDeKeys = ControlInConfiguration:WaitForChild("KeyCodes")
ConfiguracionDeKeys.ATitulo.Titulo.Text = " Atajos del teclado"
ConfiguracionDeKeys.ATitulo.Primario.Text = " Teclas"
ConfiguracionDeKeys.BMapa.Titulo.Text = " Abrir mapa"
ConfiguracionDeKeys.CDrop_objects.Titulo.Text = " Soltar objetos"
ConfiguracionDeKeys.DInteracuar.Titulo.Text = " Interactuar"
ConfiguracionDeKeys.ESprint_key.Titulo.Text = " Correr"
ConfiguracionDeKeys.GCrouch_key.Titulo.Text = " Agacharse"
ConfiguracionDeKeys.HSlot_One.Titulo.Text = " Primer slot de herramientas"
ConfiguracionDeKeys.ISlot_Slot_Two.Titulo.Text = " Segundo slot de herramientas"
ConfiguracionDeKeys.JSlot_Slot_Three.Titulo.Text = " Tercer slot de herramientas"
ConfiguracionDeKeys.KSlot_Slot_Four.Titulo.Text = " Cuarto slot de herramientas"
ConfiguracionDeKeys.LSlot_Slot_Five.Titulo.Text = " Quinto slot de herramientas"
--Graficos
local ScrollinGraficos = Ajustes:WaitForChild("Graficos"):WaitForChild("ScrollinGraficos")
local WaterConfg = ScrollinGraficos:WaitForChild("AWater")
WaterConfg.Titulo.Text = "Calidad de agua"
if Profile.Data.Game_Configurations.Graphics.Water == "Bajo" then
WaterConfg.Abrir.Text = " Bajo"
elseif Profile.Data.Game_Configurations.Graphics.Water == "Medio" then
WaterConfg.Abrir.Text = " Medio"
elseif Profile.Data.Game_Configurations.Graphics.Water == "Alto" then
WaterConfg.Abrir.Text = " Alto"
end
WaterConfg.Abrir["Frame"].Botones.ABajo.Text = "Bajo"
WaterConfg.Abrir["Frame"].Botones.BMedio.Text = "Medio"
WaterConfg.Abrir["Frame"].Botones.CAlto.Text = "Alto"
local ShadowConfg = ScrollinGraficos:WaitForChild("BSombras")
ShadowConfg.Titulo.Text = "Calidad de sombras"
if Profile.Data.Game_Configurations.Graphics.Shadows == "Bajo" then
ShadowConfg.Abrir.Text = " Bajo"
elseif Profile.Data.Game_Configurations.Graphics.Shadows == "Medio" then
ShadowConfg.Abrir.Text = " Medio"
elseif Profile.Data.Game_Configurations.Graphics.Shadows == "Alto" then
ShadowConfg.Abrir.Text = " Alto"
end
ShadowConfg.Abrir["Frame"].Botones.ABajo.Text = "Bajo"
ShadowConfg.Abrir["Frame"].Botones.BMedio.Text = "Medio"
ShadowConfg.Abrir["Frame"].Botones.CAlto.Text = "Alto"
local TreeConfg = ScrollinGraficos:WaitForChild("EArbol")
TreeConfg.Titulo.Text = "Texturas de arboles"
--Juego
local ScrollingGeneral = Ajustes:WaitForChild("Juego"):WaitForChild("ScrollingJuego")
local BrilloConfg = ScrollingGeneral:WaitForChild("Brillo")
BrilloConfg.Titulo.Text = "Brillo"
local IdiomaConfg = ScrollingGeneral:WaitForChild("Idioma")
IdiomaConfg.Titulo.Text = "Lenguaje"
IdiomaConfg.Abrir.Text = " Español"
IdiomaConfg.Abrir["Frame"].Botones.English.Frame.Visible = false
IdiomaConfg.Abrir["Frame"].Botones["Español"].Frame.Visible = true
local FpsConfg = ScrollingGeneral:WaitForChild("MostrarFps")
FpsConfg.Titulo.Text = "Mostrar FPS"
local PingConfg = ScrollingGeneral:WaitForChild("MostrarPing")
PingConfg.Titulo.Text = "Mostrar Ping"
local PoseedorDeMateriaConfg = ScrollingGeneral:WaitForChild("PoseedorDeMaterial")
PoseedorDeMateriaConfg.Titulo.Text = "Dueño de materiales"
if Profile.Data.Game_Configurations.General.PlayerChose == "ForAll" then
PoseedorDeMateriaConfg.Abrir.Text = " Sin dueño"
elseif Profile.Data.Game_Configurations.General.PlayerChose == "ForLocalPlayer" then
PoseedorDeMateriaConfg.Abrir.Text = " Privado"
elseif Profile.Data.Game_Configurations.General.PlayerChose == "ForChosenFriends" then
PoseedorDeMateriaConfg.Abrir.Text = " Compartir"
end
PoseedorDeMateriaConfg.Abrir["Frame"].Botones.DeCualquiera.Text = "Sin dueño"
PoseedorDeMateriaConfg.Abrir["Frame"].Botones.SoloYo.Text = "Privado"
PoseedorDeMateriaConfg.Abrir["Frame"].Botones.YoEamigos.Text = "Compartir"
local MenuDeCompartirMaterial = ScrollingGeneral:WaitForChild("QCompartirMaterialCon")
MenuDeCompartirMaterial.Titulo.Text = "Distribuir material con"
local SizeSlots = ScrollingGeneral:WaitForChild("TamañoDeRanuras")
SizeSlots.Titulo.Text = "Tamaño de ranuras del inventario"
--Opciones
local OptionInAjustes = Ajustes:WaitForChild("Opciones")
OptionInAjustes.AJuego.Text = "General"
OptionInAjustes.BControles.Text = "Controles"
OptionInAjustes.CGraficos.Text = "Gráficos"
OptionInAjustes.Sonido.Text = "Sonido"
--Sonido
local Sonido = Ajustes:WaitForChild("Sonido")
Sonido.Efectos.Text = "Efectos de sonido"
Sonido.Musica.Text = "MĂşsica"
Sonido.Volumenui.Text = "Sonidos UI"
--PlayerList
local Player_list = Menu_De_Mapa:WaitForChild("Playerlist")
Player_list.AllPlayers.TextLabel.Text = "Jugadores"
Player_list.ChosenPlayers.Confirmar.Text = "Confirmar"
Player_list.ChosenPlayers.Eliminar.Text = "Restablecer"
Player_list.ChosenPlayers.TextLabel.Text = "Elegidos"
for other, FoundPlayers in pairs(Player_list.ChosenPlayers.IdPlayers:GetDescendants()) do
if FoundPlayers:IsA("TextBox") then
FoundPlayers.PlaceholderText = "Escribe el nombre del jugador aquĂ"
end
if FoundPlayers:IsA("TextLabel") then
FoundPlayers.Text = "@(Nombre del jugador)"
end
end
Player_list.Titulo.Text = "Escoger jugadores"
--Menu de mapa
local Mapa = Menu_De_Mapa:WaitForChild("Mapa")
local Options_In_Mapa = Mapa:WaitForChild("Opciones")
Options_In_Mapa.Buttons.AMAPA.Text = "MAPA"
Options_In_Mapa.Buttons.BINVENTARIO.Text = "INVENTARIO"
Options_In_Mapa.Buttons.CJUGADOR.Text = "JUGADOR"
Options_In_Mapa.Buttons.DOpciones.Text = "OPCIONES"
Options_In_Mapa.Buttons.INFORMACION.Text = "INFORMACIÓN"
local ViewSelection = Mapa:WaitForChild("ViewSelection")
local Donaciones = ViewSelection:WaitForChild("Donaciones")
Donaciones.Frame.Title.Text = "Donaciones"
Donaciones.Frame.Informacion.Text = "Bueno, donar no es necesario, sin embargo, les agradecerĂa que me donen, de esta forma me podrĂ© esforzar más al momento de actualizar el juego"
local Informacion = ViewSelection:WaitForChild("Informacion")
Informacion.Creditos.Titulo.Text = "Créditos"
Informacion.Reglas.Reglas.Text =
[[1-Tratar con respeto a todos.
2-No romper el roleplay.
3-No usar trampas (exploits).
4-No molestar si no es con roleplay.
5-Actuar como si estuvieras en la vida real.
6-Nada de cosas +18.
7-Ser mayor de 14 años.
8-Seguir las regla.]]
Informacion.Reglas.Titulo.Text = "Reglas"
Informacion["ÂżComo jugar?"].Titulo.Text = "ÂżCĂłmo jugar?"
Informacion["ÂżComo jugar?"].Bio.Text =
[[Para jugar debes seguir las reglas, fingir que estás en la vida real sin estar en la vida real, toma tus decisiones como lo harĂas en tu vida.
Para tener un buen comienzo, necesitas conseguir un trabajo, comer, conocer gente y hacer un buen roleplay.
Ten en cuenta que no debes imitar lo del juego, o al menos no imites lo malo, puede llegar a ser peligroso.
Puedes molestar a tus amigos si ellos lo aceptan o estan roleando.]]
local Inventario = ViewSelection.Inventario
if Inventario.Frame.Equip.Text == "Equipar" or Inventario.Frame.Equip.Text == "Equip" then
Inventario.Frame.Equip.Text = "Equipar"
elseif Inventario.Frame.Equip.Text == "Guardar" or Inventario.Frame.Equip.Text == "Unequip" then
Inventario.Frame.Equip.Text = "Guardar"
end
if Inventario.Frame.ItemName.Text == "(Herramienta)" or Inventario.Frame.ItemName.Text == "(Tool)" then
Inventario.Frame.ItemName.Text = "(Herramienta)"
end
Inventario.Frame.Divide.Text = "Distribuir cantidad"
Inventario.Frame.Drop.Text = "Soltar"
Inventario.Frame.Use.Text = "Consumir"
Inventario.Search.PlaceholderText = "Buscar"
Inventario.Titulo.Text = "Inventario"
end,
English = function(player, PlayerAddedOrNot, Profile)
if PlayerAddedOrNot == "PlayerAdded" then
wait(10)
elseif PlayerAddedOrNot == "FireToLoadNow" then
end
local PlayerGui = player:WaitForChild("PlayerGui")
local Menu_De_Mapa = PlayerGui:WaitForChild("MenuDeMapa")
local ViewSelection = Menu_De_Mapa:WaitForChild("Mapa"):WaitForChild("ViewSelection")
local Ajustes = ViewSelection:WaitForChild("Ajustes")
--Controles
local ControlInConfiguration = Ajustes:WaitForChild("Controles")
local BotonesDeControles = ControlInConfiguration:WaitForChild("Botones")
BotonesDeControles.Controles.Text = "Controls"
BotonesDeControles.Teclas.Text = "Keys"
local ConfiguracionDeControles = ControlInConfiguration:WaitForChild("ControlScroll")
ConfiguracionDeControles.ConfCrouch.Bio.Frame.TextLabel.Text = [[
Decide if you want to press the crouch key only once to crouch, or press and hold the key to crouch ("âś”" if you want to keep pressing the key; "x" if you only want to press the key once)
]]
ConfiguracionDeControles.ConfCrouch.Data.Titulo.Text = "Crouch"
ConfiguracionDeControles.ConfSprint.Data.Titulo.Text = "Run"
local ConfiguracionDeKeys = ControlInConfiguration:WaitForChild("KeyCodes")
ConfiguracionDeKeys.ATitulo.Titulo.Text = " Keyboard shortcuts"
ConfiguracionDeKeys.ATitulo.Primario.Text = " Keys"
ConfiguracionDeKeys.BMapa.Titulo.Text = " Open map"
ConfiguracionDeKeys.CDrop_objects.Titulo.Text = " Drop objects"
ConfiguracionDeKeys.DInteracuar.Titulo.Text = " To interact"
ConfiguracionDeKeys.ESprint_key.Titulo.Text = " Run"
ConfiguracionDeKeys.GCrouch_key.Titulo.Text = " Crouch"
ConfiguracionDeKeys.HSlot_One.Titulo.Text = " First tool slot"
ConfiguracionDeKeys.ISlot_Slot_Two.Titulo.Text = " Second tool slot"
ConfiguracionDeKeys.JSlot_Slot_Three.Titulo.Text = " Third tool slot"
ConfiguracionDeKeys.KSlot_Slot_Four.Titulo.Text = " Fourth tool slot"
ConfiguracionDeKeys.LSlot_Slot_Five.Titulo.Text = " Fifth tool slot"
--Graficos
local ScrollinGraficos = Ajustes:WaitForChild("Graficos"):WaitForChild("ScrollinGraficos")
local WaterConfg = ScrollinGraficos:WaitForChild("AWater")
WaterConfg.Titulo.Text = "Water quality"
if Profile.Data.Game_Configurations.Graphics.Water == "Bajo" then
WaterConfg.Abrir.Text = " Low"
elseif Profile.Data.Game_Configurations.Graphics.Water == "Medio" then
WaterConfg.Abrir.Text = " Medium"
elseif Profile.Data.Game_Configurations.Graphics.Water == "Alto" then
WaterConfg.Abrir.Text = " High"
end
WaterConfg.Abrir["Frame"].Botones.ABajo.Text = "Low"
WaterConfg.Abrir["Frame"].Botones.BMedio.Text = "Medium"
WaterConfg.Abrir["Frame"].Botones.CAlto.Text = "High"
local ShadowConfg = ScrollinGraficos:WaitForChild("BSombras")
ShadowConfg.Titulo.Text = "Shadow quality"
if Profile.Data.Game_Configurations.Graphics.Shadows == "Bajo" then
ShadowConfg.Abrir.Text = " Low"
elseif Profile.Data.Game_Configurations.Graphics.Shadows == "Medio" then
ShadowConfg.Abrir.Text = " Medium"
elseif Profile.Data.Game_Configurations.Graphics.Shadows == "Alto" then
ShadowConfg.Abrir.Text = " High"
end
ShadowConfg.Abrir["Frame"].Botones.ABajo.Text = "Low"
ShadowConfg.Abrir["Frame"].Botones.BMedio.Text = "Medium"
ShadowConfg.Abrir["Frame"].Botones.CAlto.Text = "High"
local TreeConfg = ScrollinGraficos:WaitForChild("EArbol")
TreeConfg.Titulo.Text = "Tree textures"
--Juego
local ScrollingGeneral = Ajustes:WaitForChild("Juego"):WaitForChild("ScrollingJuego")
local BrilloConfg = ScrollingGeneral:WaitForChild("Brillo")
BrilloConfg.Titulo.Text = "Brightness"
local IdiomaConfg = ScrollingGeneral:WaitForChild("Idioma")
IdiomaConfg.Titulo.Text = "Language"
IdiomaConfg.Abrir.Text = " English"
IdiomaConfg.Abrir["Frame"].Botones.English.Frame.Visible = true
IdiomaConfg.Abrir["Frame"].Botones["Español"].Frame.Visible = false
local FpsConfg = ScrollingGeneral:WaitForChild("MostrarFps")
FpsConfg.Titulo.Text = "View FPS"
local PingConfg = ScrollingGeneral:WaitForChild("MostrarPing")
PingConfg.Titulo.Text = "View Ping"
local PoseedorDeMateriaConfg = ScrollingGeneral:WaitForChild("PoseedorDeMaterial")
PoseedorDeMateriaConfg.Titulo.Text = "Material owner"
if Profile.Data.Game_Configurations.General.PlayerChose == "ForAll" then
PoseedorDeMateriaConfg.Abrir.Text = " Without owner"
elseif Profile.Data.Game_Configurations.General.PlayerChose == "ForLocalPlayer" then
PoseedorDeMateriaConfg.Abrir.Text = " Private"
elseif Profile.Data.Game_Configurations.General.PlayerChose == "ForChosenFriends" then
PoseedorDeMateriaConfg.Abrir.Text = " Share"
end
PoseedorDeMateriaConfg.Abrir["Frame"].Botones.DeCualquiera.Text = "Without owner"
PoseedorDeMateriaConfg.Abrir["Frame"].Botones.SoloYo.Text = "Private"
PoseedorDeMateriaConfg.Abrir["Frame"].Botones.YoEamigos.Text = "Share"
local MenuDeCompartirMaterial = ScrollingGeneral:WaitForChild("QCompartirMaterialCon")
MenuDeCompartirMaterial.Titulo.Text = "Distribute material with"
local SizeSlots = ScrollingGeneral:WaitForChild("TamañoDeRanuras")
SizeSlots.Titulo.Text = "Inventory Slot Size"
--Opciones
local OptionInAjustes = Ajustes:WaitForChild("Opciones")
OptionInAjustes.AJuego.Text = "General"
OptionInAjustes.BControles.Text = "Controls"
OptionInAjustes.CGraficos.Text = "Graphics"
OptionInAjustes.Sonido.Text = "Sound"
--Sonido
local Sonido = Ajustes:WaitForChild("Sonido")
Sonido.Efectos.Text = "Sound effects"
Sonido.Musica.Text = "Music"
Sonido.Volumenui.Text = "UI sounds"
--PlayerList
local Player_list = Menu_De_Mapa:WaitForChild("Playerlist")
Player_list.AllPlayers.TextLabel.Text = "Players"
Player_list.ChosenPlayers.Confirmar.Text = "Confirm"
Player_list.ChosenPlayers.Eliminar.Text = "Restore"
Player_list.ChosenPlayers.TextLabel.Text = "Chosen"
for other, FoundPlayers in pairs(Player_list.ChosenPlayers.IdPlayers:GetDescendants()) do
if FoundPlayers:IsA("TextBox") then
FoundPlayers.PlaceholderText = "Write the player's name here"
end
if FoundPlayers:IsA("TextLabel") then
FoundPlayers.Text = "@(Player name)"
end
end
Player_list.Titulo.Text = "Choose players"
--Menu de mapa
local Mapa = Menu_De_Mapa:WaitForChild("Mapa")
local Options_In_Mapa = Mapa:WaitForChild("Opciones")
Options_In_Mapa.Buttons.AMAPA.Text = "MAP"
Options_In_Mapa.Buttons.BINVENTARIO.Text = "INVENTORY"
Options_In_Mapa.Buttons.CJUGADOR.Text = "PLAYER"
Options_In_Mapa.Buttons.DOpciones.Text = "OPTIONS"
Options_In_Mapa.Buttons.INFORMACION.Text = "INFORMATION"
local ViewSelection = Mapa:WaitForChild("ViewSelection")
local Donaciones = ViewSelection:WaitForChild("Donaciones")
Donaciones.Frame.Title.Text = "Donations"
Donaciones.Frame.Informacion.Text = "Well, donating is not necessary, however, I would appreciate if you donate to me, this way I will be able to try harder instantly to update the game"
local Informacion = ViewSelection:WaitForChild("Informacion")
Informacion.Creditos.Titulo.Text = "Credits"
Informacion.Reglas.Reglas.Text =
[[1-Treat everyone with respect.
2-Do not break the roleplay.
3-Do not use traps (exploits).
4-Do not disturb if it is not with roleplay.
5-Act as if you were in real life.
6-Nothing of things +18.
7-Be over 14 years old.
8-Follow the rules.]]
Informacion.Reglas.Titulo.Text = "Rules"
Informacion["ÂżComo jugar?"].Titulo.Text = "How to play?"
Informacion["ÂżComo jugar?"].Bio.Text =
[[To play you must follow the rules, pretend that you are in real life without being in real life, make your decisions as you would in your life.
To get off to a good start, you need to get a job, eat, meet people, and roleplay.
Keep in mind that you should not imitate the game, or at least do not imitate the bad, it can be dangerous.
You can annoy your friends if they accept it or are role-playing.]]
local Inventario = ViewSelection.Inventario
if Inventario.Frame.Equip.Text == "Equipar" or Inventario.Frame.Equip.Text == "Equip" then
Inventario.Frame.Equip.Text = "Equip"
elseif Inventario.Frame.Equip.Text == "Guardar" or Inventario.Frame.Equip.Text == "Unequip" then
Inventario.Frame.Equip.Text = "Unequip"
end
if Inventario.Frame.ItemName.Text == "(Herramienta)" or Inventario.Frame.ItemName.Text == "(Tool)" then
Inventario.Frame.ItemName.Text = "(Tool)"
end
Inventario.Frame.Divide.Text = "Distribute quantity"
Inventario.Frame.Drop.Text = "Drop"
Inventario.Frame.Use.Text = "Consume"
Inventario.Search.PlaceholderText = "Search"
Inventario.Titulo.Text = "Inventory"
end,
}
Actually, depending on the language you chose (you chose, because the language is not automatically detected), one of those two functions will be activated (of course, if you chose English, it will activate the English function)
You don’t need to use automatic translations. You can add your own translations and locations of gui objects that need translated in the language tab. This removes the need of your script and allows Roblox to handle everything for you.
It’s not possible to get the language settings of a user (likely for privacy reasons).