- What do you want to achieve? Keep it simple and clear!
Ive been experimenting around with a “Click to translate” chat system by modifying the default roblox chat recently.
- What is the issue? Include screenshots / videos if possible!
The modified chat + my code works GREAT. Expect theres one small problem… It doesnt translate the players message for some reason?
I recently started using the LocalizationService so maybe im just being dumb(Im 99% sure im not doing anything wrong since i have read through the whole page)
Code atm:
Local script
ButtonHover.MouseEnter:Connect(function()
Label.Text = Message.."[Translate]"
TranslateOnClick = ButtonHover.MouseButton1Click:Connect(function()
TranslateOnClick:Disconnect()
local TranslatedString = TranslatorModule:AttemptTranslate(game.Players.LocalPlayer, Label, Message) -- // Label is the Players Message(TextLabel)
warn(TranslatedString)
if TranslatedString ~= nil then
Label.Text = TranslatedString
end
end)
end)
Module script
local function GetTranslatorForPlr(Plr)
local Sucess, Res = pcall(function()
return Localization:GetTranslatorForPlayerAsync(Plr)
end)
if Sucess then
return Res
else
error("An error occured at getting translator: " ..Res)
return nil
end
end
function module:AttemptTranslate(Plr, Label, String)
local Translator = GetTranslatorForPlr(Plr)
if Translator ~= nil then
local Sucess, Res = pcall(function()
return Translator:Translate(Label, String)
end)
if Sucess then
return Res
else
error("An error occured at translating message: " ..Res)
return nil
end
end
end
Like i said before. I could just be dumb and be doing something wrong but i did some research and noticed that some people back in 2018 also had some problems with the Service? so my guess atm is that its something on Roblox end??