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
 

math.random

Previous Thread :: Next Thread 
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
01 Sep 2011 09:32 PM
game.Workspace.Part.Transparency = math.random

What would you say to make that work?
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
01 Sep 2011 09:34 PM
add () to the end, math.random is a function.
Report Abuse
superior is not online. superior
Joined: 13 Apr 2008
Total Posts: 1662
01 Sep 2011 09:37 PM
game.Workspace.Part.Transparency = math.random(.1,1)

This will go from .1 to 1.
Report Abuse
superior is not online. superior
Joined: 13 Apr 2008
Total Posts: 1662
01 Sep 2011 09:38 PM
Not in chronological order though, it will be random.:P
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
01 Sep 2011 09:39 PM
OH now I see, so when you say (.1,1) you mean it can be anyway random from .1 - 1?
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
01 Sep 2011 09:42 PM
@superior

I believe you can only put intergers into the parameters of math.random() all though math.random() alone will return a number between 0 and 1.
Report Abuse
superior is not online. superior
Joined: 13 Apr 2008
Total Posts: 1662
01 Sep 2011 09:45 PM
I thought you can put decimals too?
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
01 Sep 2011 09:52 PM
Even if you could use radians in it, when the function has parameters it'll return an interger thus making it useless. All though there are ways around that :

math.random(0.5)--won't work
math.random()/2--will work
Report Abuse
superior is not online. superior
Joined: 13 Apr 2008
Total Posts: 1662
01 Sep 2011 09:54 PM
Hm. Thanks for letting me know this piece of information. :)
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
02 Sep 2011 02:42 PM
Well thanks for answering my question.
Report Abuse
BCGames is not online. BCGames
Joined: 30 Dec 2010
Total Posts: 8182
02 Sep 2011 02:49 PM
@Sup

math.random requires integers, not floats.
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
02 Sep 2011 02:54 PM
@BC
Example?How to do it not what integers are.
Report Abuse
Fl0x is not online. Fl0x
Joined: 06 Aug 2010
Total Posts: 5169
02 Sep 2011 02:56 PM
math.random() returns a random number between 0 and 1 (float)
math.random(x,n) returns a random number between x and n (integer)
Report Abuse
Fl0x is not online. Fl0x
Joined: 06 Aug 2010
Total Posts: 5169
02 Sep 2011 02:57 PM
View
http://wiki.roblox.com/index.php/Function_Dump/Mathematical_Functions#math.random_.28.5Bm_.5B.2C_n.5D.5D.29
for other possibilities.
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
02 Sep 2011 02:57 PM
Ok, what does x n stand for?
Report Abuse
Fl0x is not online. Fl0x
Joined: 06 Aug 2010
Total Posts: 5169
02 Sep 2011 02:58 PM
x is the minimum integer number parameter
n is the maximum integer number parameter
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
02 Sep 2011 03:13 PM
Ok, thanks!
Report Abuse
Fl0x is not online. Fl0x
Joined: 06 Aug 2010
Total Posts: 5169
02 Sep 2011 03:14 PM
nou
i b ebil
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