Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My encryption script is returning a string that cannot be decoded?

Hey, I am working on an encryption API for my games, and I am having an issue where the script is returning this random string whereas the string is meant to be separated.

Expected: [55][74][32]

Reality:

"[[[5[5[61]]][[5[5[61]]][5[5[61]]]]][[5[5[61]]][[5[5[61]]][5[6[62]]]]]][[[5[5[61]]][[5[5[61]]][5[5[61]]]]][5[5[61]]]][[[5[5[61]]][[5[5[61]]][5[5[61]]]]][[5[5[61]]][[5[5[61]]][5[6[62]]]]]] [[[5[5[61]]][5[6[62]]]][5[6[62]]]][[[5[5[61]]][5[6[62]]]][[5[5[61]]][5[6[62]]]]][[[5[5[61]]][[5[5[61]]][5[6[62]]]]][5[61]]][[[5[5[61]]][5[6[62]]]][62]][[[5[5[61]]][5[6[62]]]][5[5[61]]]][[[5[5[61]]][5[5[61]]]][6[62]]][[[5[5[61]]][[5[5[61]]][5[6[62]]]]][5[61]]][[[5[5[61]]][5[6[62]]]][5[6[62]]]][[[5[5[61]]][5[5[61]]]][5[5[61]]]][[[5[5[61]]][5[6[62]]]][[5[5[61]]][[5[5[61]]][5[5[61]]]]]][[[5[5[61]]][5[6[62]]]][62]] [[5[5[61]]][[5[5[61]]][5[5[61]]]]][[5[5[61]]][[5[5[61]]][5[6[62]]]]][[5[5[61]]][5[6[62]]]]"

I have no clue what happened here to make it spam the crud out of characters..

Source:

local Characters = "A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/1/2/3/4/5/6/7/8/9/0"
local Split = string.split(Characters, "/")
local Script = [[
	LOL translation 124
]]
for i,v in pairs(Split) do
	wait(.1)
	str2 = "[" .. i .. "]" 
	Script = string.gsub(Script, v, str2)
end
print(Script)

1 answer

Your issue is that in Character string you have numbers and you loop replaces characters with numbers too, means numbers from 0 to 9 are replaced too.

You can see it on your own by printing the Script in each iterration in the loop, take a look at this image here

I don't know solution to your script but i wrote some code down that seems to work

local Characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"

local Script = [[
    LOL translation 124
]]

Script = string.gsub(Script, string.format('[%s]', Characters), function(Match)
	
	local Index = string.find(Characters, Match)
	
	return string.format('[%d]', Index)
end)

print(Script)
--     [12][15][12] [46][44][27][40][45][38][27][46][35][41][40] [53][54][56]

Instead of using string.split, i put function as third argument of string.gsub and anything it returns it formats, it gets index of the character and reutrns formatted version in square brackets.

Second argument was characters list formatted into square brackets which in formatting are counted as character, that means instead of looking for ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890, it will look for every single character it is containing.

This discussion is preserved as it was. New answers, comments, and votes are closed.