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: math.random() error

Previous Thread :: Next Thread 
breuning is not online. breuning
Joined: 30 Oct 2008
Total Posts: 4268
01 Apr 2012 10:10 AM
When I'm trying to make a random Vector3 then this happens:
e.Position = Vector3.new(math.random(1000, -1000), math.random(1000, -1000), math.random(1000, -1000))

_OUTPUT_:
Workspace.PCB.ExpScript:17: bad argument #2 to 'random' (interval is empty)


What does that mean , how do I fix it?
Report Abuse
malachi11 is not online. malachi11
Joined: 07 May 2008
Total Posts: 2420
01 Apr 2012 10:12 AM
The lowest number goes first. Try math.random(-1000,1000).
Report Abuse
breuning is not online. breuning
Joined: 30 Oct 2008
Total Posts: 4268
01 Apr 2012 10:13 AM
Oh. Thanks.
Report Abuse
jode6543 is not online. jode6543
Joined: 16 Jun 2009
Total Posts: 5363
01 Apr 2012 10:15 AM
Well, math.random() takes two arguments: its minimum, and its maximum. If you switch the two, and the maximum is smaller than the minimum, then you get that error. Simply swap the parameters, like so:

math.random(-1000, 1000)

And you should be fine.
Report Abuse
jode6543 is not online. jode6543
Joined: 16 Jun 2009
Total Posts: 5363
01 Apr 2012 10:15 AM
UMG LATETOAST AGAAAAAAAAIIIIIIIIIIINNNNNNN >:C
*raigfaic*
Report Abuse
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
01 Apr 2012 10:17 AM
My toast is always late. Mainly because we turn the toaster off.
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