Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Printing words one at a time, horizontally?

Asked by 6 years ago

Hi so I am scripting and I came across this small problem. I want to print the words one at a time horizontally. But when I do one at a time, It only prints in a new line. I don't want that. I don't know if it is as easy as java's println

local Description = script.Parent -- A textlabel 
local Text = {"Text", " Is", " Supposed", " To", " Print", " ARGHH"}

for i, v in pairs(Text) do
    Description.Text = v
    print(v) 
    wait(1)
end

I tried doing v .. so that the cursor stays beside the text but It errors. More specifically it gives me numbers which I do not need.

local Description = script.Parent 
local Text = {"Text", " Is", " Supposed", " To", " Print", " ARGHH"}

for i, v in pairs(Text) do
    Description.Text = v ..
    print(v ..)
    wait(1)
end

Help?

1 answer

Log in to vote
0
Answered by
Avigant 2374 Moderation Voter Community Moderator
6 years ago
Edited 6 years ago

For printing to output, simply do print(table.concat(Text)), no loop necessary for this.

For a text scrolling effect for a GUI where words scroll by, iterate through a text string like so:

local Message = "LightYagamiTheKira's Scripting Helpers answer." local TextLabel = error("define TextLabel")

local WordScrollDelay = 0.25

for Match in Message:gmatch("%w+") do TextLabel.Text = TextLabel.Text .. Match wait(WordScrollDelay) end

Ad

Answer this question