I’m wanting to make a cool text effect where I have a whole line of spaces for text and then go about replacing randomly, characters (and also keep capitalization) associated with the string (stored in a different variable) and in the proper order so for example:
Stored string == "This is a Short Text Label."
String Spaces == " " --amount of spaces == stored string
and then go through a cycle to randomly give the effect of popping up characters over time:
“T is s a h xt abel” (ignore the space format error, dev forums auto format but you should get the idea)
I took a shot at attemping and let me just say it was not pretty, honestly terrible I wouldn’t recommend looking at it, I should also mention getting nil errors with the bellow method–nevermind that it never seemed to work. If anyone can help that would be great
local StringBellow = "This is a short textlabel."
local ArrayOfChars={"T", "h", "i","s", " ", "i","s", " ", "a", " ", "s", "h", "o", "r", "t", " ", "t","e","x","t","l","a","b","e","l", "." }
local BellowString = " "
local counter=0
coroutine.wrap(function()
while counter~=27 do --amount of spaces
local ChosenNum1
local ChosenNum2
local ChosenNum3
local ChosenNum4
local ChosenNum5
repeat
ChosenNum1 = math.random(1,#BellowString)
print(ChosenNum1)
if ArrayOfChars[ChosenNum1]==" " then
table.remove(ArrayOfChars,ChosenNum1)
end
until ArrayOfChars[ChosenNum1]~=" " and ArrayOfChars[ChosenNum1]~= nil
counter+=1
string.gsub(BellowString, ChosenNum1, ArrayOfChars[ChosenNum1])
script.Parent.CriminalObjective.CrimObjectiveLabel.Text=BellowString
table.remove(ArrayOfChars,ChosenNum1)
wait(.05)
repeat
ChosenNum2 = math.random(1,#BellowString)
if ArrayOfChars[ChosenNum2]==" " then
table.remove(ArrayOfChars,ChosenNum2)
end
until ArrayOfChars[ChosenNum2]~=" " and ArrayOfChars[ChosenNum2]~= nil
string.gsub(BellowString, ChosenNum2, ArrayOfChars[ChosenNum2])
script.Parent.CriminalObjective.CrimObjectiveLabel.Text=BellowString
table.remove(ArrayOfChars,ChosenNum2)
if counter==27 then
break
end
wait(.05)
repeat
ChosenNum3 = math.random(1,#BellowString)
if ArrayOfChars[ChosenNum3]==" " then
table.remove(ArrayOfChars,ChosenNum3)
end
until ArrayOfChars[ChosenNum3]~=" " and ArrayOfChars[ChosenNum3]~= nil
counter+=1
string.gsub(BellowString, ChosenNum3, ArrayOfChars[ChosenNum3])
script.Parent.CriminalObjective.CrimObjectiveLabel.Text=BellowString
table.remove(ArrayOfChars,ChosenNum3)
wait(.05)
repeat
ChosenNum4 = math.random(1,#BellowString)
if ArrayOfChars[ChosenNum4]==" " then
table.remove(ArrayOfChars,ChosenNum4)
end
until ArrayOfChars[ChosenNum4]~=" " and ArrayOfChars[ChosenNum3]~= nil
counter+=1
string.gsub(BellowString, ChosenNum4, ArrayOfChars[ChosenNum4])
script.Parent.CriminalObjective.CrimObjectiveLabel.Text=BellowString
table.remove(ArrayOfChars,ChosenNum4)
wait(.05)
repeat
ChosenNum5 = math.random(1,#BellowString)
if ArrayOfChars[ChosenNum5]==" " then
table.remove(ArrayOfChars,ChosenNum5)
end
until ArrayOfChars[ChosenNum5]~=" " and ArrayOfChars[ChosenNum5]~= nil
counter+=1
string.gsub(BellowString, ChosenNum5, ArrayOfChars[ChosenNum5])
script.Parent.CriminalObjective.CrimObjectiveLabel.Text=BellowString
table.remove(ArrayOfChars,ChosenNum5)
wait(.05)
end
end)()