dialog = script.Parent dialog.Text = "H" wait(0.1) dialog.Text = "He" wait(0.1) dialog.Text = "Hey" wait(0.1) dialog.Text = "Hey " wait(0.1) dialog.Text = "Hey y" wait(0.1) dialog.Text = "Hey yo" wait(0.1) dialog.Text = "Hey you" wait(0.1) dialog.Text = "Hey you," wait(0.1) dialog.Text = "Hey you, " wait(0.1) dialog.Text = "Hey you, y" wait(0.1) dialog.Text = "Hey you, ye" wait(0.1) dialog.Text = "Hey you, yea" wait(0.1) dialog.Text = "Hey you, yea " wait(0.1) dialog.Text = "Hey you, yea y" wait(0.1) dialog.Text = "Hey you, yea yo" wait(0.1) dialog.Text = "Hey you, yea you" wait(0.1) dialog.Text = "Hey you, yea you!" wait(0.1) dialog.Text = "Hey you, yea you!" wait(0.1) dialog.Text = "Hey you, yea you! " wait(0.1) dialog.Text = "Hey you, yea you! D" wait(0.1) dialog.Text = "Hey you, yea you! Do" wait(0.1) dialog.Text = "Hey you, yea you! Do " wait(0.1) dialog.Text = "Hey you, yea you! Do y" wait(0.1) dialog.Text = "Hey you, yea you! Do yo" wait(0.1) dialog.Text = "Hey you, yea you! Do you" wait(0.1) dialog.Text = "Hey you, yea you! Do you " wait(0.1) dialog.Text = "Hey you, yea you! Do you r" wait(0.1) dialog.Text = "Hey you, yea you! Do you re" wait(0.1) dialog.Text = "Hey you, yea you! Do you rem" wait(0.1) dialog.Text = "Hey you, yea you! Do you reme" wait(0.1) dialog.Text = "Hey you, yea you! Do you remem" wait(0.1) dialog.Text = "Hey you, yea you! Do you rememb" wait(0.1) dialog.Text = "Hey you, yea you! Do you remembe" wait(0.1) dialog.Text = "Hey you, yea you! Do you remember" wait(0.1) dialog.Text = "Hey you, yea you! Do you remember " wait(0.1) dialog.Text = "Hey you, yea you! Do you remember a" wait(0.1) dialog.Text = "Hey you, yea you! Do you remember an" wait(0.1) dialog.Text = "Hey you, yea you! Do you remember any" wait(0.1) dialog.Text = "Hey you, yea you! Do you remember anyt" wait(0.1) dialog.Text = "Hey you, yea you! Do you remember anyth" wait(0.1) dialog.Text = "Hey you, yea you! Do you remember anythi" wait(0.1) dialog.Text = "Hey you, yea you! Do you remember anythin" wait(0.1) dialog.Text = "Hey you, yea you! Do you remember anything" wait(0.1) dialog.Text = "Hey you, yea you! Do you remember anything?" wait(0.1)
What I'm trying to do is make it so all the text doesn't appear at once, but adds one letter at a time. If you don't get what I mean, it's basically like the Pokemon text, and I was wondering if there was a faster way to do this, or do I have to write each one, one at a time? Thanks for the help!
Of course there's an easier way to do it. You would want to use string manipulation and a for loop to change the text of the TextLabel (or other object). So to set it up, you want to have a variable set to the message you want. You would then want a numeric for loop which by default adds 1 to the variable i each time it loops through. When setting the value of the text label, you will want to use the sub function of strings to get the text from point a to point b basically.
local Message = "Hey you, yea you! Do you remember anything?" --We set the variable here, we will be able to reference it later in the script. local dialog = script.Parent for i=1, Message:len() do --The :len() method on Message is what will get how many characters are in the string you defined above. So everything between 1 and however long the string is, the for loop will execute. dialog.Text = Message:sub(1,i) --i is basically a variable we defined when creating the for loop, i could be placement or any other means of defining the variable you want. The script is now getting all the characters between 1 and the i variable at the time the loop is executing. --1 is added to i automatically in a for loop. wait(.1) --This is the wait you wanted. end --With all for loops, you need an end.
Yep!
local text = "Hey you, yea you! Do you remember anything?" for i = 1, #text do -- #text is length of text dialog.Text = text:sub(1, i) -- text:sub(1, i) is only the first through i letters in the string wait(.1) end
You could use the numeric for loop.
local word = "Hey you, yea you! Do you remember anything?" dialog = script.Parent for i=1, string.len(word) do -- run the loop the amount of characters there are dialog.Text = string.sub(word,1,i) wait(0.1) end