OK, so let me explain; You know on the news, there is this scrolling text that loops? Well I want to try to make that. If you're still don't understand what I'm to make, check this GIF out.
local t = script.Parent while true do t.Text = "AAA " wait(0.05) t.Text = " AAA " wait(0.05) t.Text = " AAA " wait(0.05) t.Text = " AAA " wait(0.05) t.Text = " AAA " wait(0.05) t.Text = " AAA" wait(0.05) t.Text = "A AA" wait(0.05) t.Text = "AA A" wait(0.05) end
Now I can make the scrolling text using the code above, but I don't like using it because it takes up too much space; 19 lines is too much! Is there a way to make it taking up less space?
Here's whats imo a better approach, it's shorter (9 lines and can be trimmed further but I am sure it's gonna do the job well enough now)
local loopMe = "123456 " local sLength = string.len(loopMe) while wait(.05) do local newLetter = string.sub(loopMe, sLength, sLength) local newString = string.sub(loopMe, 1, sLength-1) local Yep_Here = newLetter .. newString loopMe = Yep_Here print(Yep_Here) end
Not sure if you need an explanation for this one because you seem advanced enough to understand it. Let me know if you need one.
But basically all it does is take the last letter and make it the first one and so on.
Also, in case whoever is reading this likes making code do a lot while being short, I recommend this: https://codegolf.stackexchange.com/