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 trouble

Previous Thread :: Next Thread 
nicecomicbanned is not online. nicecomicbanned
Joined: 17 Jan 2011
Total Posts: 272
20 Jan 2011 05:51 AM
I am trying to make exhaust from a rocket thruster from my free-model-free space cruiser but...
The 8th line has a few problems and I don't know what D:

while true do
p = Instance.new("Part")
p.ParenWorkspace.Part.Script:8: bad argument #2 to 'random' (interval is empty)t = game.Workspace
p.Name = "Fuel"
p.Anchored = true
p.Position = Vector3.new(math.random(script.Parent.Position.x + 20, script.Parent.Position.x - 20), math.random(script.Parent.Position.y + 20, script.Parent.Position.y - 20), math.random(script.Parent.Position.z + 20, script.Parent.Position.z - 20))
p.CanCollide = false
p.BrickColor = BrickColor.new("Neon orange")
p:BreakJoints()
wait()
end

Workspace.Part.Script:8: bad argument #2 to 'random' (interval is empty)

it says "interval is empty", but it's not... what SHOULD I have in there instead of what I do have in there?

BTW before you say I'm a noob, this account is a new account, yes, but it's an alt. my main, comiconor, is an 09er.
Report Abuse
bunnybunn264 is not online. bunnybunn264
Joined: 04 Oct 2010
Total Posts: 5409
20 Jan 2011 05:57 AM
If it said "interval empty", then you put the higher number in math.random first. Just switch it around, and it should work fine. By that, I mean always have the lower number first.

math.random(0,13) <-- GOOD

math.random(7,2) <-- BAD
Report Abuse
WhileTrue is not online. WhileTrue
Joined: 19 Jan 2011
Total Posts: 242
20 Jan 2011 06:02 AM
No one would say you a noob.

Also, do you mean this line?

p.Position = Vector3.new(math.random(script.Parent.Position.x + 20, script.Parent.Position.x - 20), math.random(script.Parent.Position.y + 20, script.Parent.Position.y - 20), math.random(script.Parent.Position.z + 20, script.Parent.Position.z - 20))

I don't know, the forum automatically adds line breaks. If it was this line, maybe "script.Parent.Position.x" isn't a numerical value.
Report Abuse
bunnybunn264 is not online. bunnybunn264
Joined: 04 Oct 2010
Total Posts: 5409
20 Jan 2011 06:03 AM
script.Parent.Position.X IS, though. You need the uppercase.
Report Abuse
WhileTrue is not online. WhileTrue
Joined: 19 Jan 2011
Total Posts: 242
20 Jan 2011 06:03 AM
Or.. bunny's solution. Try putting "math.random(script.Parent.Position.x - 20, script.Parent.Position.x + 20), " instead of "math.random(script.Parent.Position.x +- 20, script.Parent.Position.x - 20), "
Report Abuse
nicecomicbanned is not online. nicecomicbanned
Joined: 17 Jan 2011
Total Posts: 272
21 Jan 2011 05:38 AM
got it! lowest interval first, got it.
Report Abuse
HyperBlue is not online. HyperBlue
Joined: 06 Aug 2009
Total Posts: 1166
21 Jan 2011 05:56 AM
The capitalization of the Vector3 elements doesn't matter.
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