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 Question

Previous Thread :: Next Thread 
QU1NTESSENCE is not online. QU1NTESSENCE
Joined: 03 Jun 2012
Total Posts: 72
09 Jun 2012 05:52 PM
If I have a table, such as this one:

messages {"test1","test2","test3","test4"}

How would I call the table's contents randomly and set the text of something to it?

In other words, I want to have a hint (game.Workspace.Hint) to show the table's text at random. How do I do that?

Any help would be appreciated.
Report Abuse
NeonBlox is not online. NeonBlox
Joined: 19 Oct 2008
Total Posts: 1462
09 Jun 2012 05:54 PM
messages = {"test1","test2","test3","test4"}
h = Instance.new("Hint", workspace)

while true do
h.Text = messages[math.random(1,#messages)]
wait(3)
end
Report Abuse
QU1NTESSENCE is not online. QU1NTESSENCE
Joined: 03 Jun 2012
Total Posts: 72
09 Jun 2012 05:55 PM
Manythanks
Report Abuse
NeonBlox is not online. NeonBlox
Joined: 19 Oct 2008
Total Posts: 1462
09 Jun 2012 05:55 PM
Just to reduce it by a line...

messages = {"test1","test2","test3","test4"}
h = Instance.new("Hint", workspace)

while wait(3) do
h.Text = messages[math.random(1,#messages)]
end
Report Abuse
flappydavid is not online. flappydavid
Joined: 03 May 2009
Total Posts: 5893
09 Jun 2012 06:04 PM
Or by two:

messages,h = {"test1","test2","test3","test4"},Instance.new("Hint",game.Workspace)
while wait(3) do
h.Text = messages[math.random(1,#messages)]
end
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