alright, so lets break down the loop first.
for i = 1, #message
this means this loop will run for #message
times.
#message
is the length of the local message
string given.
for example, in the script you showed, message is “UNSEEN INTERACTIVE” which has a total of 18 characters. Thus, your loop will run 18 times.
________
now, string.sub
is used to get a portion of text from a string.
For example its used to get the first 5 letters of a word, or the last 3 letters etc.
the first thing you put in the brackets of string.sub()
is the string you want to shorten/get a part of.
In this case, we will put the message
in the brackets as such : string.sub(message)
the second thing you put in the brackets of string.sub()
is the number you want to start from,
Example, if you put 3
, the result of string.sub will start from the third letter/character of the string
.
Example Code :
local your_string = "HEY This is a TEST!"
local result = string.sub(your_string,2,#your_string)
print(result)
-- this will print 'EY This is a TEST!` (because we put 2 in the middle, it started from the second letter)
Now the third, thing you put in the brackets of string.sub()
is the number till where the string will go.
Example you put the number 5
in there. So the String will start from the number you put in the second section to the number you put in the third section.
Example - string.sub(your_string,1,5)
this means the result will start from the first letter and end at the 5th letter. it will ignore all letters ahead the 5th letter.
________
sorry if im bad at explaining, i tried my BEST To detail it out.