Roblox translator v2 (fixed) --// SERVICES local Players = game:GetService("Players") local HttpService = game:GetService("HttpService") local UserInputService = game:GetService("UserInputService") local CoreGui = game:GetService("CoreGui") local player = Players.LocalPlayer ------------------------------------------------- -- REMOVE OLD GUI ------------------------------------------------- pcall(function() local old = CoreGui:FindFirstChild("UniversalTranslatorGUI") if old then old:Destroy() end end) ------------------------------------------------- -- GUI ------------------------------------------------- local screenGui = Instance.new("ScreenGui") screenGui.Name = "UniversalTranslatorGUI" screenGui.ResetOnSpawn = false screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling pcall(function() screenGui.Parent = CoreGui end) if not screenGui.Parent then screenGui.Parent = player:WaitForChild("PlayerGui") end ------------------------------------------------- -- VARIABLES ------------------------------------------------- local selectedLanguage = "ja" local minimized = false ------------------------------------------------- -- MAIN FRAME ------------------------------------------------- local mainFrame = Instance.new("Frame") mainFrame.Size = UDim2.new(0, 540, 0, 320) mainFrame.Position = UDim2.new(0.5, -270, 0.5, -160) mainFrame.BackgroundColor3 = Color3.fromRGB(20,20,20) mainFrame.BorderSizePixel = 0 mainFrame.Active = true mainFrame.Parent = screenGui local mainCorner = Instance.new("UICorner") mainCorner.CornerRadius = UDim.new(0,12) mainCorner.Parent = mainFrame ------------------------------------------------- -- TOP BAR ------------------------------------------------- local topBar = Instance.new("Frame") topBar.Size = UDim2.new(1,0,0,45) topBar.BackgroundColor3 = Color3.fromRGB(30,30,30) topBar.BorderSizePixel = 0 topBar.Parent = mainFrame local topCorner = Instance.new("UICorner") topCorner.CornerRadius = UDim.new(0,12) topCorner.Parent = topBar local title = Instance.new("TextLabel") title.Size = UDim2.new(0.7,0,1,0) title.Position = UDim2.new(0.03,0,0,0) title.BackgroundTransparency = 1 title.Text = "Universal Translator" title.TextXAlignment = Enum.TextXAlignment.Left title.Font = Enum.Font.GothamBold title.TextScaled = true title.TextColor3 = Color3.new(1,1,1) title.Parent = topBar ------------------------------------------------- -- MINIMIZE BUTTON ------------------------------------------------- local minimizeButton = Instance.new("TextButton") minimizeButton.Size = UDim2.new(0,35,0,35) minimizeButton.Position = UDim2.new(1,-45,0.5,-17) minimizeButton.BackgroundColor3 = Color3.fromRGB(255,170,0) minimizeButton.Text = "-" minimizeButton.Font = Enum.Font.GothamBold minimizeButton.TextScaled = true minimizeButton.TextColor3 = Color3.new(1,1,1) minimizeButton.Parent = topBar local minCorner = Instance.new("UICorner") minCorner.CornerRadius = UDim.new(0,8) minCorner.Parent = minimizeButton ------------------------------------------------- -- CONTENT FRAME ------------------------------------------------- local contentFrame = Instance.new("Frame") contentFrame.Size = UDim2.new(1,0,1,-45) contentFrame.Position = UDim2.new(0,0,0,45) contentFrame.BackgroundTransparency = 1 contentFrame.Parent = mainFrame ------------------------------------------------- -- DRAGGING (FULLY WORKS MINIMIZED) ------------------------------------------------- local dragging = false local dragStart local startPos local function beginDrag(input) dragging = true dragStart = input.Position startPos = mainFrame.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false end end) end -- DRAG TOP BAR topBar.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then beginDrag(input) end end) -- DRAG WHOLE GUI WHEN OPEN mainFrame.InputBegan:Connect(function(input) if not minimized then if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then beginDrag(input) end end end) -- UPDATE POSITION UserInputService.InputChanged:Connect(function(input) if dragging then if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then local delta = input.Position - dragStart mainFrame.Position = UDim2.new( startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y ) end end end) ------------------------------------------------- -- INPUT BOX ------------------------------------------------- local inputBox = Instance.new("TextBox") inputBox.Size = UDim2.new(0.88,0,0,45) inputBox.Position = UDim2.new(0.06,0,0,15) inputBox.BackgroundColor3 = Color3.fromRGB(40,40,40) inputBox.PlaceholderText = "Enter English text..." inputBox.Text = "" inputBox.TextColor3 = Color3.new(1,1,1) inputBox.Font = Enum.Font.Gotham inputBox.TextScaled = true inputBox.ClearTextOnFocus = false inputBox.Parent = contentFrame Instance.new("UICorner", inputBox) ------------------------------------------------- -- OUTPUT LABEL ------------------------------------------------- local outputLabel = Instance.new("TextLabel") outputLabel.Size = UDim2.new(0.88,0,0,70) outputLabel.Position = UDim2.new(0.06,0,0,75) outputLabel.BackgroundColor3 = Color3.fromRGB(35,35,35) outputLabel.Text = "" outputLabel.TextColor3 = Color3.new(1,1,1) outputLabel.Font = Enum.Font.GothamBold outputLabel.TextScaled = true outputLabel.TextWrapped = true outputLabel.Parent = contentFrame Instance.new("UICorner", outputLabel) ------------------------------------------------- -- BUTTON CONTAINER ------------------------------------------------- local buttonContainer = Instance.new("Frame") buttonContainer.Size = UDim2.new(0.88,0,0,120) buttonContainer.Position = UDim2.new(0.06,0,0,165) buttonContainer.BackgroundTransparency = 1 buttonContainer.ClipsDescendants = true buttonContainer.Parent = contentFrame ------------------------------------------------- -- GRID LAYOUT ------------------------------------------------- local grid = Instance.new("UIGridLayout") grid.CellSize = UDim2.new(0,120,0,40) grid.CellPadding = UDim2.new(0,15,0,15) grid.FillDirectionMaxCells = 3 grid.HorizontalAlignment = Enum.HorizontalAlignment.Center grid.VerticalAlignment = Enum.VerticalAlignment.Top grid.SortOrder = Enum.SortOrder.LayoutOrder grid.Parent = buttonContainer ------------------------------------------------- -- LANGUAGE BUTTONS ------------------------------------------------- local languages = { {"Japanese","ja"}, {"Korean","ko"}, {"Chinese","zh-CN"}, } for _, info in ipairs(languages) do local button = Instance.new("TextButton") button.BackgroundColor3 = Color3.fromRGB(50,50,50) button.Text = info[1] button.TextColor3 = Color3.new(1,1,1) button.Font = Enum.Font.GothamBold button.TextScaled = true button.Parent = buttonContainer Instance.new("UICorner", button) button.MouseButton1Click:Connect(function() selectedLanguage = info[2] end) end ------------------------------------------------- -- TRANSLATE BUTTON ------------------------------------------------- local translateButton = Instance.new("TextButton") translateButton.BackgroundColor3 = Color3.fromRGB(0,170,255) translateButton.Text = "Translate" translateButton.TextColor3 = Color3.new(1,1,1) translateButton.Font = Enum.Font.GothamBold translateButton.TextScaled = true translateButton.Parent = buttonContainer Instance.new("UICorner", translateButton) ------------------------------------------------- -- TRANSLATION FUNCTION ------------------------------------------------- local function translateText(text, targetLang) local url = "https://translate.googleapis.com/translate_a/single" .. "?client=gtx" .. "&sl=en" .. "&tl=" .. targetLang .. "&dt=t&q=" .. HttpService:UrlEncode(text) local success, result = pcall(function() return game:HttpGet(url) end) if not success then return "HTTP Failed" end local decodeSuccess, data = pcall(function() return HttpService:JSONDecode(result) end) if not decodeSuccess then return "Decode Failed" end if data and data[1] and data[1][1] and data[1][1][1] then return data[1][1][1] end return "Translation Error" end ------------------------------------------------- -- TRANSLATE ------------------------------------------------- local function doTranslate() local text = inputBox.Text if text == "" then return end outputLabel.Text = "Translating..." local translated = translateText(text, selectedLanguage) outputLabel.Text = translated pcall(function() if setclipboard then setclipboard(translated) outputLabel.Text = translated .. " (Copied)" elseif toclipboard then toclipboard(translated) outputLabel.Text = translated .. " (Copied)" end end) end translateButton.MouseButton1Click:Connect(doTranslate) ------------------------------------------------- -- ENTER KEY SUPPORT ------------------------------------------------- inputBox.FocusLost:Connect(function(enterPressed) if enterPressed then doTranslate() end end) ------------------------------------------------- -- MINIMIZE SYSTEM ------------------------------------------------- local normalSize = UDim2.new(0, 540, 0, 320) local minimizedSize = UDim2.new(0, 540, 0, 45) minimizeButton.MouseButton1Click:Connect(function() minimized = not minimized if minimized then contentFrame.Visible = false mainFrame.Size = minimizedSize minimizeButton.Text = "+" else contentFrame.Visible = true mainFrame.Size = normalSize minimizeButton.Text = "-" end end)