|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 06 May 2013 10:01 PM |
| why not try it on roblox studio |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|