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: Random position change test..

Previous Thread :: Next Thread 
barl99 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. barl99
Joined: 28 Dec 2009
Total Posts: 2318
08 Aug 2011 03:51 PM
I see.
Report Abuse
barl99 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. barl99
Joined: 28 Dec 2009
Total Posts: 2318
09 Aug 2011 06:35 AM
Line 4 is meant to be 2.
Report Abuse
barl99 is not online. barl99
Joined: 28 Dec 2009
Total Posts: 2318
09 Aug 2011 06:43 AM
Nevermind, i get it now :D
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