generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Game Design
Home Search
 

Re: Display text 1 letter at a time

Previous Thread :: Next Thread 
tahu157 is not online. tahu157
Joined: 16 Nov 2008
Total Posts: 15045
02 Jan 2016 11:11 AM
So say I had a string of text that I want to put in a TextLabel, how would I get it to add one letter at a time?

E.g:

T
Th
Thi
This
This i
This is
This is t
This is te
This is Tex
This is Text

I know I can do something like this:

TextLabel.Text = "T"
wait (0.1)
TextLabel.Text = "Th"

and so on until I get the full message. But is there a way to get that same effect without writing the same thing over and over and over again with one letter added each time?
Report Abuse
heirIoom is not online. heirIoom
Joined: 15 Jul 2012
Total Posts: 3775
02 Jan 2016 11:27 AM
local text = "Let us continue on. "

local frame = script.Parent.Parent
local text1 = script.Parent

local sound = Instance.new("Sound",workspace)
sound.SoundId = "http://www.roblox.com/asset/?id=14863866"
sound.Pitch = 1
sound.Volume = 0.5

for i = 1,string.len(text),1 do
sound:play()
text1.Text = string.sub(text,1,i)
wait(.5)
end
wait(1.5)
Report Abuse
tahu157 is not online. tahu157
Joined: 16 Nov 2008
Total Posts: 15045
02 Jan 2016 11:33 AM
Awesome, thank you. I was sort of headed in that direction:


local msgs = {"This", "is", "a", "test"}

while (true) do
wait (0.1)
print "Stuff"
script.Changer.Value = script.Changer.Value + 1
script.Parent.Text = script.Parent.Text..msgs[script.Changer.Value]
end



Wasn't quite there though.
Report Abuse
ByDefault is not online. ByDefault
Joined: 25 Jul 2014
Total Posts: 3197
02 Jan 2016 12:42 PM
Much shorter

local s = "This is the string"

for = 1,string.len(s) do
print(string.sub(s,1,i))
end
Report Abuse
heirIoom is not online. heirIoom
Joined: 15 Jul 2012
Total Posts: 3775
03 Jan 2016 06:50 AM
@ByDefault
Only difference is myn plays a sound on each letter.
Report Abuse
tahu157 is not online. tahu157
Joined: 16 Nov 2008
Total Posts: 15045
03 Jan 2016 09:23 AM
It's also missing the i in the for statement and a wait statement, without which the game crashes.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image