How can I shorten this code to only a couple of lines?

Right now, I have this computer screen that basically displays text one letter at a time, and as a beginner scripter, it looks like a hot mess. I’ve learned how to do this easily in python, but I don’t know how I could convert something like that to lua.
image
How could I shorten this abomination???

Try this out:

local message = "UNSEEN INTERACTIVE"
local label = --where ever the gui is located

for i = 1, #message do
    label.Text = string.sub(message, 1, i)
    task.wait(.05)
end
2 Likes

Thanks man, this really helped!

1 Like

Use :split("Hello there", "") to divide the string and use a for i,v in pairs() loop to iterate through the table the split function provided script.Parent.Text = script.Parent.Text..v make sure to add a wait() command on the top of the for loop

Please do more research before posting here, there are many articles on this

2 Likes

Thanks, I’ll make sure to keep that in mind next time I’m stumped