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
 

I forget,

Previous Thread :: Next Thread 
Sunsshines is not online. Sunsshines
Joined: 16 Sep 2012
Total Posts: 8395
03 Oct 2013 02:38 PM
How do I do math.random, chooses a number, and if it, for example, chose the first choice then it would do this?

I'm trying to make a weather script. 7 weathers (weather = {"Rain", "Thunder", "Fog", "Drizzle", "Foggy Rain", "Foggy Rain and Thunder", "Clear"}).

I know how to do the rest, just not the math.random if chose this then do that part, I forgot (I used to know).
Report Abuse
DangCoolIsReal is not online. DangCoolIsReal
Joined: 03 Jun 2013
Total Posts: 4110
03 Oct 2013 02:44 PM
rand = math.random(1, #weather)
print(weather[rand])
Report Abuse
Sunsshines is not online. Sunsshines
Joined: 16 Sep 2012
Total Posts: 8395
03 Oct 2013 02:46 PM
if rand = 1 then
bla bla bla
end

is that correct?
Report Abuse
DangCoolIsReal is not online. DangCoolIsReal
Joined: 03 Jun 2013
Total Posts: 4110
03 Oct 2013 02:48 PM
local weather = {"Rain", "Thunder", "Fog", "Drizzle", "Foggy Rain", "Foggy Rain and Thunder", "Clear"}
local rand = math.random(1, #weather)
if weather[rand] == "Thunder" then
--stuff
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