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: Message - Randomizing Table

Previous Thread :: Next Thread 
drew8732 is not online. drew8732
Joined: 01 Apr 2010
Total Posts: 1965
30 Dec 2011 10:06 AM
So, I need to make a table within my round script of my zombie place that generates a random message after every round, like in MW3 Survival. Messages like, "Look out, that's not the end of them," or, "Good job men, check weapons and ammunition." So, how would I do that so it pulls a random message and is said at the end of every round?
Report Abuse
ggfunny1234 is not online. ggfunny1234
Joined: 09 Jul 2010
Total Posts: 3432
30 Dec 2011 10:10 AM
wiki.roblox.com

Report Abuse
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
30 Dec 2011 10:11 AM
[ Content Deleted ]
Report Abuse
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
30 Dec 2011 10:14 AM
I think it's pairs or inpairs. It should be on wiki.roblox.com.
Report Abuse
drew8732 is not online. drew8732
Joined: 01 Apr 2010
Total Posts: 1965
30 Dec 2011 10:21 AM
Ok, I'm gonna still need help though. I don't know much more about LUA than printing in output and changing brick's properties.
Report Abuse
drew8732 is not online. drew8732
Joined: 01 Apr 2010
Total Posts: 1965
30 Dec 2011 10:23 AM
Umm... yeah... I'm lost.
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
30 Dec 2011 10:30 AM
phrases = {"Phrase one","The second","etcetera"}

function ending()
local t = Instance.new("Message",Workspace)
local z = math.random(#phrases)
t.Text = phrases[z]
wait(4)
t:destroy()
end



Now, at the end of your game's script, call this function, which should be located with the phrases table, before it is called.
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
30 Dec 2011 10:32 AM
What this script does is..

When you call 'ending', it runs the function.
It creates a new message in Workspace.
It chooses a random number between 1, and the number of phrases in the table.
It then sets the Text of the Message to the item in the 'phrases' table, with the index of the random number.
Report Abuse
drew8732 is not online. drew8732
Joined: 01 Apr 2010
Total Posts: 1965
30 Dec 2011 11:35 AM
Alright, here's the problem. Though thanks for giving me that script. My script goes as such:

[Zombie Round Functions]
[Zombie Round Functions]
[Nuclear Zombie Round Functions]

How would I apply that script you gave me to the way my script is formatted?
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
30 Dec 2011 11:52 AM
Put it at the very top of your script.

Whenever you need it, just make a line that says..
ending()

Report Abuse
drew8732 is not online. drew8732
Joined: 01 Apr 2010
Total Posts: 1965
31 Dec 2011 05:29 PM
AWESHUM! A SH'er that actually gives a helpless person a script. Thanks.
Report Abuse
VaderTahu101 is not online. VaderTahu101
Joined: 04 Sep 2008
Total Posts: 111
31 Dec 2011 05:35 PM
Use math.Random(1,2) then list the 2 functions (in this case, text for the message) that occur based on the number generated.
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