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: areal debris

Previous Thread :: Next Thread 
Clayguy247 is not online. Clayguy247
Joined: 03 Sep 2008
Total Posts: 3394
06 May 2013 09:51 PM
trying to spawn debris inside a brick that will spawn anywhere inside the area of the brick but not outside.

A script inside a brick that spawns bricks anywhere inside the area of its parent brick.

How would I do this?
I was thinking something like

Newbrick.Position = Vector3.new(script.Parent.Position.X + math.random(script.Parent.Size.X),script.Parent.Position.Y + math.random(script.Parent.Size.Y),script.Parent.Position.Z+ math.random(script.Parent.Size.Z))

But this is a wild guess.
Report Abuse
DroptheBomb is not online. DroptheBomb
Joined: 04 Nov 2010
Total Posts: 235
06 May 2013 09:55 PM
newbrick.Position = Vector3.new(math.random(script.Parent.Position.X-(script.Parent.Size.X/2),script.Parent.Position.X+(script.Parent.Size.X/2)), math.random(script.Parent.Position.Y-(script.Parent.Size.Y/2),script.Parent.Position.Y+(script.Parent.Size.Y/2)), math.random(script.Parent.Position.Z-(script.Parent.Size.Z/2),script.Parent.Position.Z+(script.Parent.Size.Z/2)))

something like that
Report Abuse
Clayguy247 is not online. Clayguy247
Joined: 03 Sep 2008
Total Posts: 3394
06 May 2013 09:58 PM
b.Position = script.Parent.Position + Vector3.new(math.random(-(script.Parent.Size.X-1),(script.Parent.Size.X-1)),math.random(-(script.Parent.Size.Y-1),(script.Parent.Size.Y-1)),math.random(-(script.Parent.Size.Z-1),(script.Parent.Size.Z-1)))

thats what I did. Would that work?
Report Abuse
DroptheBomb is not online. DroptheBomb
Joined: 04 Nov 2010
Total Posts: 235
06 May 2013 10:01 PM
why not try it on roblox studio
Report Abuse
Clayguy247 is not online. Clayguy247
Joined: 03 Sep 2008
Total Posts: 3394
06 May 2013 10:07 PM
It seems to work, but Im not sure if its exactly the correct math. Oh well thanks
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