|
| 09 Sep 2012 05:20 PM |
Okay so I want to not how to make the position random, but with a specified range.
local a = Instance.new("Part", Workspace) a.Position = Vector3.new(...)
Or if you like using CFrame better you use CFrame. Any help appreciated. |
|
|
| Report Abuse |
|
|
| |
|
MrChubbs
|
  |
| Joined: 14 Oct 2010 |
| Total Posts: 4969 |
|
|
| 09 Sep 2012 05:24 PM |
local a = Instance.new("Part", Workspace) a.Position = Vector3.new(math.random(-DistanceRange, +DistanceRange), math.random(-DistanceRange, +DistanceRange), math.random(-DistanceRange, +DistanceRange))
(- and + mean the ends of the spectrum, you dont need the +) Will make a brick within a radius of DistanceRange
|
|
|
| Report Abuse |
|
|
|
| 09 Sep 2012 05:26 PM |
Lol, right before you posted I figured it out, but thanks!
Just to make sure, is there a more efficient way fore my script?
while wait(2) do local a = Instance.new("Part", Workspace) a.Position = Vector3.new(math.random(1,50), math.random(10,15), math.random(1,50)) end |
|
|
| Report Abuse |
|
|
MrChubbs
|
  |
| Joined: 14 Oct 2010 |
| Total Posts: 4969 |
|
|
| 09 Sep 2012 05:34 PM |
while wait(2) do Instance.new("Part", Workspace).Position = Vector3.new(math.random(1,50), math.random(10,15), math.random(1,50)) end
Other than that, no. |
|
|
| Report Abuse |
|
|
| |
|
MrChubbs
|
  |
| Joined: 14 Oct 2010 |
| Total Posts: 4969 |
|
| |
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 09 Sep 2012 05:39 PM |
Localize your function fetches to make it the most efficient script you can. Instead of Instance.new and math.random all of the time in each loop, cache the functions.
local Inew = Instance.new local ran = math.random
-- Loop |
|
|
| Report Abuse |
|
|
|
| 09 Sep 2012 05:41 PM |
but the amount of time saved by doing this would be minimal, wouldn't it? computers are very fast these days. i once heard most modern computers can perform a billion operations per second.
¬ Scripter Tier-2, LuaLearners Elite ♣ scripting teacher/freelance worker ♣ send me trade requests! |
|
|
| Report Abuse |
|
|
|
| 09 Sep 2012 05:46 PM |
Thanks! Just to clarify, to use CFrame, just in case I wanted them inside each other instead of stacking, would it be like this;
Part.CFrame = CFrame.new(Numbers) |
|
|
| Report Abuse |
|
|