Universal Script ๐Ÿ“Œ
697 Views
948 Executions

chat translator to english

Universal Script ๐Ÿ“Œ
ChatGPT
ChatGPTPublished 5
8 months ago
Get an executor
Please login to perform these actions:

Does it work?

No reports yet

No 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

View Raw
-- 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

0
Log in to join the conversation. Login
No comments yet. Be the first!

More universal scripts

See all
Universal Script ๐Ÿ“Œ
6.4k
30.7k
Bumped 3 minutes ago
Script hub
17.0k
112.2k
Bumped 25 minutes ago
Key System

Script hub

Kronos New

Script hub
5.6M
1.2M
Bumped 4 hours ago
Key System
Universal Script ๐Ÿ“Œ
1.9k
6.7k
Bumped 6 hours ago
Script hub
23.3k
5.0k
Bumped 8 hours ago
Key System
Paid
High Qualityย Offering
Script hub
4.1M
546.8k
Bumped 8 hours ago
Key System

Script hub

Hall of Fame #3

Verified script badgeOverflow #1 *OP*

Universal Script ๐Ÿ“Œ
14.5k
57.3k
Bumped 12 hours ago
High Qualityย Offering
Script hub
2.9M
977.8k
Bumped 12 hours ago
Key System