[SOLVED] Is it possible to make a script "Obfuscator Effect"?

I want to make something of this kind: the example, however I do not understand how to grab an index through each character list and take only 1 random number and place it instead of a character.

However: I am getting an error that says:
image

Here’s my script:

local ObfuscatorList = {}
local Characters = "ABCEFGHIJKLMNOPQRSTUVWYZabcefghijklmnopqrstyvwyz1234567890!@#$%^&*()_+`~<>|{}[];:"

function ObfuscatorList.Obfuscator(GuiObject, TextLabel, DelayBetweenChars)
	
	GuiObject.Visible = true
	
	local Text = TextLabel
	local Length = GuiObject.Text
	GuiObject.Text = Text
	local CharacterIndex = 0
	
	for first, last in utf8.graphemes(Text) do
		CharacterIndex += 1
		local RandomIndex = math.random(0, string.len(Characters))
		local i = 0
		print("RandomIndex")
		GuiObject.Text = string.find(Characters, RandomIndex, string.len(Length), true) 

		GuiObject.MaxVisibleGraphemes = CharacterIndex
		wait(DelayBetweenChars)
   end
end

return ObfuscatorList

You can’t call Random like a function. If you are trying to generate a random number between minimum and maximum number, you can call math.random instead.


Also, what are you exactly trying to put in Text.Text?

Text.Text gets the TextLabel text which is set in another script.

No, I meant like you are trying to set TextLabel to something, but what is that you want to set it to?

To a text label,
image
image
TextJoin is a text label.

When trying math.random it still makes an error:
image

When getting the length of a string, you have to use string.len instead of Characters.len
It’s not a function within the instance, so your code should look like this:

Text.Text = math.random(0,string.len(Characters))
2 Likes

I see, but it prints out the len of whatever the random landed on, and not the index of the thing it landed on

Change

local RandomIndex = math.random(0, string.len(Characters))

To

local RandomIndex = math.random(0, #Characters)
1 Like