How to translate text

does anyone know how i can make whatever i type into a textbox will show on a textlabel the translated text so like if i want the letter a=b so the word apple would show bpple on the textlabel or if i wanted L=P
and O=T and N=R and G=E, the word LONG would show PTRE on the textlabel

pls help

1 Like

i already made something like this

local Language = {
	["A"] = "A",
	["B"] = "B",
	["C"] = "C",
	["D"] = "D",
	["E"] = "E",
	["F"] = "F",
	["G"] = "G",
	["H"] = "H",
	["I"] = "I",
	["J"] = "J",
	["K"] = "K",
	["L"] = "L",
	["M"] = "M",
	["N"] = "N",
	["O"] = "O",
	["P"] = "P",
	["Q"] = "Q",
	["R"] = "R",
	["S"] = "S",
	["T"] = "T",
	["U"] = "U",
	["V"] = "V",
	["W"] = "W",
	["X"] = "X",
	["Y"] = "Y",
	["Z"] = "Z",

	["a"] = "a",
	["b"] = "b",
	["c"] = "c",
	["d"] = "d",
	["e"] = "e",
	["f"] = "f",
	["g"] = "g",
	["h"] = "h",
	["i"] = "i",
	["j"] = "j",
	["k"] = "k",
	["l"] = "l",
	["m"] = "m",
	["n"] = "n",
	["o"] = "o",
	["p"] = "p",
	["q"] = "q",
	["r"] = "r",
	["s"] = "s",
	["t"] = "t",
	["u"] = "u",
	["v"] = "v",
	["w"] = "w",
	["x"] = "x",
	["y"] = "y",
	["z"] = "z",
}

local Tools = {}

function Tools.TranslateToLanguage(String)
	local TranslatedString = " "

	for i=1, string.len(String) do
		local Letter = string.sub(String, i, i)
		local Found = false

		for Text, TranslatedText in pairs(Language) do
			if Text == Letter then
				Found = true
				TranslatedString = TranslatedString .. TranslatedText
			end
		end

		if not Found then
			TranslatedString = TranslatedString .. Letter
		end
	end

	return TranslatedString
end

function Tools.TranslateToString(String)
	local TranslatedString = " "

	for i=1, string.len(String) do
		local Letter = string.sub(String, i, i)

		local Found = false

		for LanguageText, NewTextFromLanguage in pairs(Language) do
			if Letter == NewTextFromLanguage and not Found then
				TranslatedString = TranslatedString .. LanguageText
				Found = true
			end
		end

		if not Found then
			TranslatedString = TranslatedString .. Letter
		end
	end

	return TranslatedString
end

return Tools
1 Like

how do i use it

sdadsadwasdsdsdwa

because there is functions and stuff but i dont know how to use it is it supposed to be like a module script or just a local script

well how do i use it is it supposed to be a module script??

local Module = require() -- the
local String = "hello"

print(Module.TranslateToLanguage(String))

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.