|
| 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
|
  |
| 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 |
|
|
| |
|
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 |
|
|
|
| 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 |
|
|