| The Vector3.new() Function (and more) | |
|
|
Author | Message |
---|
Supernapalm Expert Scripter
Posts : 393 Join date : 2011-01-17
| Subject: The Vector3.new() Function (and more) January 18th 2011, 11:40 pm | |
| Dedicate to the one's who have no clue about scripting whatsoever Vector3.new() is a function. Functions in Lua are things that you use to edit something. This tutorial explains how to use Vector3.new. Vector3.new() has many uses in ROBLOX. It can be used for Position, Size, Velocity, Force, and many more things. Let's start with the basics. To use Vector3.new(), you must put something, anything, inside the parenthesis. Note that not all functions require this, but this function must edit 3 values, each standing for 3 dimensions. So in reality, its Vector3.new(%x, y, z%). For example. If you want to change your Position, this is not the way to go: - Code:
-
game.Workspace.%Player%.Torso.Position = 0,100,0[/strike] --[[change %Player% into your name--]] You must do this: - Code:
-
game.Workspace.%Player%.Torso.Position = Vector3.new(0,100,0) Hooray! You learned how to use Vector3.new(x,y,z)! Now. Let's take this deeper. If you were to do something like this... - Code:
-
game.Workspace.%Player%.Torso.Position = Vector3.new(%x, z%) ... you would get x, y, not x, z right? You want to just change your x and z dimensions. To fix this you do this: - Code:
-
[[game.Workspace.%Player%.Torso.Position = game.Workspace.%Player%.Torso.Position + Vector3.new(%x%, 0, %z%)]] --[[ i just use brackets for multi-line stuff --]] There's another thing I wan't to go over. If you add math.random(%x, y%) into play, you can have more power than you can ever imagine. math.random(%x, y%) is an important function, of course, for random numbers. Now you can make your dimensions go wild! Also the Instance.new("%String%) function is good to use. With this function you can create many object players use to build things on ROBLOX. while true do simply means make an infinite loop. To execute the loop, you must end the loop with end. This can only be broken with the function break(), but let's not get to technical here. Let's use Velocity this time. - Code:
-
while true do local vel = Instance.new("BodyVelocity") [[vel.Velocity = Vector3.new(math.random(1,100), math.random(1,100), math.random(1,100))]] vel.Parent = workspace.%Player%.Torso --[[ workspace is shortcut for game.Workspace]] wait(5) end This is the end of the tutorial. Have fun!
PM me if you found a mistake in this.
Last edited by Supernapalm on January 24th 2011, 9:30 pm; edited 1 time in total | |
|
| |
Supernapalm Expert Scripter
Posts : 393 Join date : 2011-01-17
| Subject: Re: The Vector3.new() Function (and more) January 18th 2011, 11:41 pm | |
| hmmm... this looks pretty good | |
|
| |
blueymaddog Administrator
Posts : 1081 Join date : 2010-12-09 Age : 26
| Subject: Re: The Vector3.new() Function (and more) January 19th 2011, 6:46 am | |
| | |
|
| |
naknak Administrator
Posts : 878 Join date : 2010-07-30
| Subject: Re: The Vector3.new() Function (and more) January 19th 2011, 8:03 pm | |
| | |
|
| |
Supernapalm Expert Scripter
Posts : 393 Join date : 2011-01-17
| Subject: Re: The Vector3.new() Function (and more) January 19th 2011, 8:50 pm | |
| thx, but i just thought about adding wait(10) in the while true do loop | |
|
| |
Supernapalm Expert Scripter
Posts : 393 Join date : 2011-01-17
| Subject: Re: The Vector3.new() Function (and more) January 19th 2011, 8:50 pm | |
| nah, it would be too complicated for beginners. | |
|
| |
naknak Administrator
Posts : 878 Join date : 2010-07-30
| Subject: Re: The Vector3.new() Function (and more) January 19th 2011, 9:54 pm | |
| - Code:
-
while wait(10) do I always use that | |
|
| |
Supernapalm Expert Scripter
Posts : 393 Join date : 2011-01-17
| Subject: Re: The Vector3.new() Function (and more) January 19th 2011, 10:24 pm | |
| | |
|
| |
Supernapalm Expert Scripter
Posts : 393 Join date : 2011-01-17
| Subject: Re: The Vector3.new() Function (and more) January 19th 2011, 10:31 pm | |
| how does it work, though? does wait() return true when it is executed, and return false when the function is completed? that's what im thinking
| |
|
| |
blueymaddog Administrator
Posts : 1081 Join date : 2010-12-09 Age : 26
| Subject: Re: The Vector3.new() Function (and more) January 20th 2011, 6:29 pm | |
| | |
|
| |
naknak Administrator
Posts : 878 Join date : 2010-07-30
| Subject: Re: The Vector3.new() Function (and more) January 20th 2011, 7:11 pm | |
| wait() always returns true | |
|
| |
Supernapalm Expert Scripter
Posts : 393 Join date : 2011-01-17
| Subject: Re: The Vector3.new() Function (and more) January 20th 2011, 9:04 pm | |
| oh. nvm. i was thinking something else. | |
|
| |
myrco919 Intermediate Scripter
Posts : 190 Join date : 2011-01-21 Age : 26 Location : Holland
| Subject: Re: The Vector3.new() Function (and more) January 24th 2011, 9:48 am | |
| v.Position = (((p.Position + v.Position)/2) + p.Position ^ 2)
:33 | |
|
| |
Supernapalm Expert Scripter
Posts : 393 Join date : 2011-01-17
| Subject: Re: The Vector3.new() Function (and more) January 24th 2011, 8:24 pm | |
| what are you talking about? | |
|
| |
CloneTrooper787 Moderator
Posts : 81 Join date : 2011-01-22
| Subject: Re: The Vector3.new() Function (and more) January 25th 2011, 10:10 pm | |
| @naknak- while true do wait(10) --seems more formal to me than while wait(10) do | |
|
| |
naknak Administrator
Posts : 878 Join date : 2010-07-30
| Subject: Re: The Vector3.new() Function (and more) January 25th 2011, 10:12 pm | |
| while wait(10) do -- more convienent for people who have to encrypt there code (like me)
Size matters. The smaller it is, the easier it is to encrypt. But I am the only one who ever encrypts, so bleh. | |
|
| |
CloneTrooper787 Moderator
Posts : 81 Join date : 2011-01-22
| Subject: Re: The Vector3.new() Function (and more) January 25th 2011, 10:38 pm | |
| Note to self: Size matters; Smaller is easier... | |
|
| |
naknak Administrator
Posts : 878 Join date : 2010-07-30
| Subject: Re: The Vector3.new() Function (and more) January 25th 2011, 10:39 pm | |
| Smaller is easier IF you can handle it ;) | |
|
| |
Supernapalm Expert Scripter
Posts : 393 Join date : 2011-01-17
| Subject: Re: The Vector3.new() Function (and more) January 25th 2011, 11:43 pm | |
| but the disadvantage is that you must wait10) first. maybe this is what you want, maybe not. | |
|
| |
blueymaddog Administrator
Posts : 1081 Join date : 2010-12-09 Age : 26
| Subject: Re: The Vector3.new() Function (and more) January 26th 2011, 10:14 am | |
| if u wanna encrypt something then don't use white spaces. And make the function names shorter:
p=print p("hi") | |
|
| |
blueymaddog Administrator
Posts : 1081 Join date : 2010-12-09 Age : 26
| Subject: Re: The Vector3.new() Function (and more) January 26th 2011, 10:16 am | |
| I made an encrypted that can encrypt over 2000000 characters without crashing! I tested it with a 272k long line script! :P | |
|
| |
Supernapalm Expert Scripter
Posts : 393 Join date : 2011-01-17
| Subject: Re: The Vector3.new() Function (and more) January 27th 2011, 9:37 pm | |
| how do you encrypt your script with lua? | |
|
| |
blueymaddog Administrator
Posts : 1081 Join date : 2010-12-09 Age : 26
| Subject: Re: The Vector3.new() Function (and more) February 8th 2012, 4:59 am | |
| | |
|
| |
Sponsored content
| Subject: Re: The Vector3.new() Function (and more) | |
| |
|
| |
| The Vector3.new() Function (and more) | |
|