
KeylessUniversal

-- Configuration
local TargetLanguage = "en" -- English
local Players = game:GetService("Players")
local HttpService = game:GetService("HttpService")
-- Function to handle the translation request
local function translateText(text)
local url = string.format(
"https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=%s&dt=t&q=%s",
TargetLanguage,
HttpService:UrlEncode(text)
)
-- Using the standard executor 'request' function
local success, response = pcall(function()
return request({
Url = url,
Method = "GET"
})
end)
if success and response.StatusCode == 200 then
local data = HttpService:JSONDecode(response.Body)
if data and data[1] and data[1][1] then
return data[1][1][1]
end
end
return nil
end
-- Function to monitor players
local function monitorPlayer(player)
if player == Players.LocalPlayer then return end
player.Chatted:Connect(function(msg)
local translated = translateText(msg)
-- Only show if the translation is different from the original message
if translated and translated:lower() ~= msg:lower() then
print(string.format("[%s]: %s (Original: %s)", player.Name, translated, msg))
-- Displaying in the system chat (Standard for executors)
game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage", {
Text = string.format("[%s]: %s", player.Name, translated),
Color = Color3.fromRGB(0, 255, 127), -- Spring Green
Font = Enum.Font.SourceSansBold
})
end
end)
end
-- Hook existing and new players
for _, player in ipairs(Players:GetPlayers()) do
monitorPlayer(player)
end
Players.PlayerAdded:Connect(monitorPlayer)
print("Chat Translator Loaded: Language is set to English.")No comments yet for this script.



