
685 Views
670 Executions
chat translator to english
Universal Script 📌
ChatGPTPublished 5
7 months ago
Please login to perform these actions:Does it work?
No reports yetNo reports yet. Tried it? Be the first to say.
Also noticed:
Description
a chat translator that I made with chatgpt without even testing the script cause im such a chud if there is any problems with the script unless you have a crappy executor let me know
-- 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))
Comments
0Log in to join the conversation. Login
No comments yet. Be the first!




