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 » Scripting Helpers
Home Search
 

Re: Table

Previous Thread :: Next Thread 
cooldude999921 is not online. cooldude999921
Joined: 13 Aug 2011
Total Posts: 3702
01 Jan 2014 01:12 PM
How would you break up strings in a table to display in a Gui

Kind of like

r.Text = "T"
wait(1)
r.Text = "Te"
wait(1)
r.Text = "Tex"
wait(1)
r.Text = "Text"

But strings that are in a table

_StringTable = {
"Lol";
"String";
"bro";
}

And display them in a Gui

So

repeat
Gui.Text = ..?
until not wait(5)

Medium Script0r
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
01 Jan 2014 01:19 PM
function displayText(string)
for i = 1, string:len() do -- for i = 1, the length of the string do
Gui.Text = string:sub(1, i) -- The part of the string from characters 1 to i
end
end

displayText(_StringTable[1])

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
CrniOrao is not online. CrniOrao
Joined: 12 Oct 2008
Total Posts: 2274
01 Jan 2014 01:20 PM
What's the _StringTable[1] for?
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
01 Jan 2014 01:22 PM
_StringTable[1] is the first index of the table. Basically:

for i = 1, 10 do
print(tbl[i]) -- I is the step number that you are on
end

I was pretty much just making sure you understood how to use the function I wrote up for you.

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
cooldude999921 is not online. cooldude999921
Joined: 13 Aug 2011
Total Posts: 3702
01 Jan 2014 01:23 PM
So you grab the length and then break it with :sub or string.sub.. Nice

thank you time to use it c:

Medium Script0r
Report Abuse
cooldude999921 is not online. cooldude999921
Joined: 13 Aug 2011
Total Posts: 3702
01 Jan 2014 01:37 PM
k I made an edit and it erroed'

function displayText(string)
for i = 1, string:len() do -- for i = 1, the length of the string do
Gui.Text = string:sub(1, i) -- The part of the string from characters 1 to i
end
end

displayText(math.random(1, #_StringTable)) -- Supposed to pick random String from table and break it's characters


Medium Script0r
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
01 Jan 2014 02:06 PM
You forgot to index your random number:

displayText(_StringTable[math.random(1, #_StringTable)])
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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