barl99
|
  |
| Joined: 28 Dec 2009 |
| Total Posts: 2318 |
|
|
| 08 Aug 2011 03:33 PM |
Ok so i got this...
while true do game.Workspace.Dirt.Position = Position.random() end
--It's fairly simple, but doesn't work and soon i need to find a way to move WHOLE models.. D: |
|
|
| Report Abuse |
|
|
ThePHPguy
|
  |
| Joined: 05 Aug 2011 |
| Total Posts: 35 |
|
|
| 08 Aug 2011 03:39 PM |
Hello barl,
Position is what is known as a "Vector3 value" therefore you will have to use a Vector3 and math.random() to get your new position.
while Wait(5) do -- so it doesn't crash. game.Workspace.Dirt.Position=Vector3.new(math.random(-200,200),math.random(-200,200)) end
and that's how you do it. |
|
|
| Report Abuse |
|
|
barl99
|
  |
| Joined: 28 Dec 2009 |
| Total Posts: 2318 |
|
|
| 08 Aug 2011 03:41 PM |
| Dang, so i have to insert every SINGLE vector in the game to make it work? This could take a while... I knew it was something about Vector3 because of my knowledge in C-framing, but i couldn't quite figure what it was. Thanks anyway. |
|
|
| Report Abuse |
|
|
barl99
|
  |
| Joined: 28 Dec 2009 |
| Total Posts: 2318 |
|
|
| 08 Aug 2011 03:42 PM |
| Oh yeah, and can i put while true do and then wait(5) before end? |
|
|
| Report Abuse |
|
|
ThePHPguy
|
  |
| Joined: 05 Aug 2011 |
| Total Posts: 35 |
|
|
| 08 Aug 2011 03:45 PM |
Yes you can, I prefer to put the wait() like that especially if it's meant to be an infinite loop. This works because it's basically saying
while wait(5) works do
instead of
while a boolean(true) do wait(5)
|
|
|
| Report Abuse |
|
|
barl99
|
  |
| Joined: 28 Dec 2009 |
| Total Posts: 2318 |
|
| |
|
barl99
|
  |
| Joined: 28 Dec 2009 |
| Total Posts: 2318 |
|
|
| 08 Aug 2011 03:52 PM |
| Anyway of doing whole models at once without have to insert every brick in to the script? Probably not Dx |
|
|
| Report Abuse |
|
|
ThePHPguy
|
  |
| Joined: 05 Aug 2011 |
| Total Posts: 35 |
|
|
| 08 Aug 2011 03:56 PM |
Yes actually there is. You just have to use this function called MoveTo like so:
workspace.Model:MoveTo(Vector3.new(2,3,4))
and that will move your model for you. |
|
|
| Report Abuse |
|
|
barl99
|
  |
| Joined: 28 Dec 2009 |
| Total Posts: 2318 |
|
|
| 09 Aug 2011 01:55 AM |
| Wow, thanks ALOT! That could help in alot in other games aswell! |
|
|
| Report Abuse |
|
|
barl99
|
  |
| Joined: 28 Dec 2009 |
| Total Posts: 2318 |
|
|
| 09 Aug 2011 06:34 AM |
Need more help D:
Tue Aug 09 12:31:26 2011 - Workspace.Randomizer.:4: wrong number of arguments Tue Aug 09 12:31:26 2011 - Script "Workspace.Randomizer.", Line 4 Tue Aug 09 12:31:26 2011 - stack end
What the heck? I entered this script...
while Wait(5) do -- so it doesn't crash. game.Workspace.Dirt.Position=Vector3.new(math.random(60, 27.6, 17.5),math.random(-8, 27.6, 17.5),math.random(-52.5, 27.6, -89)) end |
|
|
| Report Abuse |
|
|
barl99
|
  |
| Joined: 28 Dec 2009 |
| Total Posts: 2318 |
|
| |
|
barl99
|
  |
| Joined: 28 Dec 2009 |
| Total Posts: 2318 |
|
|
| 09 Aug 2011 06:43 AM |
| Nevermind, i get it now :D |
|
|
| Report Abuse |
|
|