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 » Scripters
Home Search
 

math.random help

Previous Thread :: Next Thread 
Leg0brick is not online. Leg0brick
Joined: 24 Jul 2012
Total Posts: 651
10 Feb 2015 11:13 PM
This bit of code:
b.Position = Vector3.new(math.random(55,60),math.random(90,90),math.random(130,30))
Gives me this error:
21:10:17.855 - Workspace.Part.Script:6: bad argument #2 to 'random' (interval is empty)
Please help!
Thanks for reading!
Report Abuse
ChiefDelta is not online. ChiefDelta
Joined: 05 Nov 2010
Total Posts: 13071
10 Feb 2015 11:15 PM
Reverse 30 and 130.
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
10 Feb 2015 11:16 PM
Your Z axis.. you're trying to get a random number in between 130 and 30, 130 being minimum and 30 being maximum.. see why that errors? Change it.
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
10 Feb 2015 11:20 PM
too bad math.random doesn't work like this


local function random(x, y)
if (x) then
return math.random(math.min(x, (y or 1)), math.max(x, (y or 1)));
else
return math.random();
end
end

print(random()) -->random number from 0 to 1, not int

print(random(10)) -->random number from 1 to 10

print(random(-10)) -->random number from -10 to 1

print(random(5, 10)) -->random number from 5 to 10

print(random(10, 5)) -->random number from 5 to 10
Report Abuse
parkiet3 is not online. parkiet3
Joined: 16 Jul 2011
Total Posts: 832
11 Feb 2015 12:34 AM
math.random(90,90) im not sure but better write 90+math.random() if you want it between them
Report Abuse
Skyman772 is not online. Skyman772
Joined: 20 Mar 2012
Total Posts: 9305
11 Feb 2015 10:02 AM
Why would you do math.random(90,90)? That's always going to print 90 - it would be much more efficient for you to just do:

b.Position = Vector3.new(math.random(55,60),90,math.random(30,130))
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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