Hello, Im Fasola16 and today I gonna teach you about making the voice a language by chosen experience language.
Why i did this tutorial?
Maybe some of you played the games (not talking about roblox games) and some of you know, how to change the language in game, that changes the voices of some characters. But in roblox there no experience that have character voices by choosing experience language. And thats why I here to teach you how to achieve that.
INFO
For better mean, i will put an example:
You’re spanish person that play a game in english. You dont understand the english text and voice, so you try to change it to spanish text and voice in settings.
How to achieve that?
Maybe some of you know how to make a language for a text by using auto translation in localization. But in localization there no any tool that would make translate voice to any specific language. to make localization use diffirent language voice, we must use script for that.
Scripting the speech voice in language by chosen experience language
For first we must get player added function and then set the parameter name:
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
end)
Then we need “.LocaleId” string, that will check the player’s current experience language. Then print the “.LocaleId” Id:
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local localeId = player.LocaleId
print(localeId)
end)
Printing localeId its important, because we need it Id for checking it. the LocaleId code has two letters and looks like for ex.: pl-pl, de-de etc.
INFO
Some of LocaleId’s Id has diffirent two letters words but their language is diffirent. for ex. en-us for united states and en-gb for great britain. The Id building looks like this:
Language-Country
if you get printed localeId Id from testing place, copy it. Now add “if” statement, then type localeid == “code here” then paste the copied Id between quotation marks .In here we will use Id “pl-pl” as polish language:
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local localeId = player.LocaleId
print(localeId)
if localeId == "pl-pl" then
end
end)
INFO
if the Id has diffirent two letters words, you need to write that:
if locale = "en-us" or locale = "en-gb" then
Now, we’re gonna make the voice play when player has Polish experience language.
INFO
If you cant find some languages voices, you can improvise using sounds than voices for testing.
Make folder in SoundService naming it for ex.:“Languages” then put voice/language inside of this folder. Then make a code to make it play that using “:Play()”:
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local localeId = player.LocaleId
print(localeId)
if localeId == "pl-pl" then
game.SoundService.Languages.PolishHello:Play()
end
end)
The script its almost complete. We need only to make the diffirent sounds/voices play in diffirent languages. For that we need change the language experience, not in studio but in experience. Joining here and changing the language to your language you want and reseting character for script reset will result getting another LocaleId Id in dev console. You cant copy from dev console but you can type in chat and copy it. Then return to studio with copied Id. Now we’re gonna use “elseif” for checking another LocaleId Id, that will play another Voice/Sound. In this script I will use “de-de” as Deutch language.
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local localeId = player.LocaleId
print(localeId)
if localeId == "pl-pl" then
game.SoundService.Languages.PolishHello:Play()
elseif localeId == "de-de" then
game.SoundService.Languages.DeutchHello:Play()
end
end)
Now go back to the experience and test it. The result must be that when having experience language on polish will play a voice/sound, and when having experience language on deutch will play a diffirent voice/sound than in polish.
Summary
- To make the voices in diffirent experience language You need to use “.LocaleId” string for getting Id that its important tool for making the script.
- You cant test experience languages in roblox studio, but you can test in experience.
- You need to make sound for each diffirent language.
- You can also use “.LocaleId” string for making the text in diffirent languages.
That is all from now! If you have more question, ask in comments ![]()