A Roblox Community
Would you like to react to this message? Create an account in a few clicks or log in to continue.

A Roblox Community

A community of Robloxians who want to learn to script and build on Roblox Studio.
 
HomeLatest imagesRegisterLog in
If you're a experienced coder make some tutorials! It would really help the site grow.
Make sure you read the rules(Which can be found by clicking here)
If you're a beginner at coding, try some tutorials.
We have many Moderators/Admins watching this site. Contact them with Questions.
Let us know what your favorite sport is. By clicking here to vote (Click here)
This site is becoming inactive. Lets make it active.
Log in
Username:
Password:
Log in automatically: 
:: I forgot my password
Top posters
blueymaddog
The Vector3.new() Function (and more) Vote_lcapThe Vector3.new() Function (and more) Voting_barThe Vector3.new() Function (and more) Vote_rcap 
naknak
The Vector3.new() Function (and more) Vote_lcapThe Vector3.new() Function (and more) Voting_barThe Vector3.new() Function (and more) Vote_rcap 
Supernapalm
The Vector3.new() Function (and more) Vote_lcapThe Vector3.new() Function (and more) Voting_barThe Vector3.new() Function (and more) Vote_rcap 
m27frogy
The Vector3.new() Function (and more) Vote_lcapThe Vector3.new() Function (and more) Voting_barThe Vector3.new() Function (and more) Vote_rcap 
slayer9365
The Vector3.new() Function (and more) Vote_lcapThe Vector3.new() Function (and more) Voting_barThe Vector3.new() Function (and more) Vote_rcap 
myrco919
The Vector3.new() Function (and more) Vote_lcapThe Vector3.new() Function (and more) Voting_barThe Vector3.new() Function (and more) Vote_rcap 
branefreez
The Vector3.new() Function (and more) Vote_lcapThe Vector3.new() Function (and more) Voting_barThe Vector3.new() Function (and more) Vote_rcap 
ninga95
The Vector3.new() Function (and more) Vote_lcapThe Vector3.new() Function (and more) Voting_barThe Vector3.new() Function (and more) Vote_rcap 
CloneTrooper787
The Vector3.new() Function (and more) Vote_lcapThe Vector3.new() Function (and more) Voting_barThe Vector3.new() Function (and more) Vote_rcap 
raboy117
The Vector3.new() Function (and more) Vote_lcapThe Vector3.new() Function (and more) Voting_barThe Vector3.new() Function (and more) Vote_rcap 
Top posting users this month
No user
Latest topics
» Where to go from here.
The Vector3.new() Function (and more) EmptySeptember 14th 2020, 1:20 pm by MrNicNac

» Send me an Email
The Vector3.new() Function (and more) EmptySeptember 14th 2020, 1:16 pm by MrNicNac

» [v1.6.0.0] Lua Script Obfuscator [No Bytecode]
The Vector3.new() Function (and more) EmptyJuly 6th 2015, 7:38 pm by m27frogy

» New Site Possibly
The Vector3.new() Function (and more) EmptyJuly 6th 2015, 4:16 pm by m27frogy

» Ambassador!
The Vector3.new() Function (and more) EmptyApril 15th 2015, 11:40 pm by naknak

» Boop - Tag
The Vector3.new() Function (and more) EmptyApril 13th 2015, 9:46 pm by naknak

» Vip Class Script
The Vector3.new() Function (and more) EmptyApril 13th 2015, 4:54 pm by naknak

» Who's active?!
The Vector3.new() Function (and more) EmptyApril 13th 2015, 4:52 pm by naknak

» Genesis Point
The Vector3.new() Function (and more) EmptyJuly 17th 2014, 7:04 pm by branefreez

» Reward System
The Vector3.new() Function (and more) EmptyJuly 17th 2014, 5:41 am by m27frogy

» Script Request
The Vector3.new() Function (and more) EmptyJuly 10th 2014, 11:43 am by naknak

» local scripts?
The Vector3.new() Function (and more) EmptyJuly 10th 2014, 11:39 am by naknak

» Project: Reconstruction [Died]
The Vector3.new() Function (and more) EmptyJuly 10th 2014, 11:36 am by naknak

» Hi. I am new here
The Vector3.new() Function (and more) EmptyApril 26th 2014, 4:01 pm by altshiftkey

» What's your favorite sport?
The Vector3.new() Function (and more) EmptyJanuary 1st 2014, 2:13 pm by m27frogy

» FlashLight Script
The Vector3.new() Function (and more) EmptyJanuary 1st 2014, 2:11 pm by m27frogy

» Gun Making! [READ DESC]
The Vector3.new() Function (and more) EmptyJanuary 1st 2014, 2:10 pm by m27frogy

» Hi, I am new here!
The Vector3.new() Function (and more) EmptyNovember 26th 2013, 3:33 pm by Keanu73

» Improve Coding
The Vector3.new() Function (and more) EmptyOctober 26th 2013, 1:12 pm by pook03

» Simple Button
The Vector3.new() Function (and more) EmptySeptember 1st 2013, 6:19 pm by branefreez


 

 The Vector3.new() Function (and more)

Go down 
5 posters
AuthorMessage
Supernapalm
Expert Scripter
Expert Scripter
avatar


Posts : 393
Join date : 2011-01-17

The Vector3.new() Function (and more) Empty
PostSubject: The Vector3.new() Function (and more)   The Vector3.new() Function (and more) EmptyJanuary 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
Back to top Go down
http://hackthissite.org
Supernapalm
Expert Scripter
Expert Scripter
avatar


Posts : 393
Join date : 2011-01-17

The Vector3.new() Function (and more) Empty
PostSubject: Re: The Vector3.new() Function (and more)   The Vector3.new() Function (and more) EmptyJanuary 18th 2011, 11:41 pm

hmmm... this looks pretty good
Back to top Go down
http://hackthissite.org
blueymaddog
Administrator
Administrator
blueymaddog


Posts : 1081
Join date : 2010-12-09
Age : 26

The Vector3.new() Function (and more) Empty
PostSubject: Re: The Vector3.new() Function (and more)   The Vector3.new() Function (and more) EmptyJanuary 19th 2011, 6:46 am

not bad
Back to top Go down
naknak
Administrator
Administrator
naknak


Posts : 878
Join date : 2010-07-30

The Vector3.new() Function (and more) Empty
PostSubject: Re: The Vector3.new() Function (and more)   The Vector3.new() Function (and more) EmptyJanuary 19th 2011, 8:03 pm

Lengthy, nice.
Back to top Go down
Supernapalm
Expert Scripter
Expert Scripter
avatar


Posts : 393
Join date : 2011-01-17

The Vector3.new() Function (and more) Empty
PostSubject: Re: The Vector3.new() Function (and more)   The Vector3.new() Function (and more) EmptyJanuary 19th 2011, 8:50 pm

thx, but i just thought about adding wait(10) in the while true do loop
Back to top Go down
http://hackthissite.org
Supernapalm
Expert Scripter
Expert Scripter
avatar


Posts : 393
Join date : 2011-01-17

The Vector3.new() Function (and more) Empty
PostSubject: Re: The Vector3.new() Function (and more)   The Vector3.new() Function (and more) EmptyJanuary 19th 2011, 8:50 pm

nah, it would be too complicated for beginners.
Back to top Go down
http://hackthissite.org
naknak
Administrator
Administrator
naknak


Posts : 878
Join date : 2010-07-30

The Vector3.new() Function (and more) Empty
PostSubject: Re: The Vector3.new() Function (and more)   The Vector3.new() Function (and more) EmptyJanuary 19th 2011, 9:54 pm

Code:
while wait(10) do

I always use that
Back to top Go down
Supernapalm
Expert Scripter
Expert Scripter
avatar


Posts : 393
Join date : 2011-01-17

The Vector3.new() Function (and more) Empty
PostSubject: Re: The Vector3.new() Function (and more)   The Vector3.new() Function (and more) EmptyJanuary 19th 2011, 10:24 pm

nice
Back to top Go down
http://hackthissite.org
Supernapalm
Expert Scripter
Expert Scripter
avatar


Posts : 393
Join date : 2011-01-17

The Vector3.new() Function (and more) Empty
PostSubject: Re: The Vector3.new() Function (and more)   The Vector3.new() Function (and more) EmptyJanuary 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
Back to top Go down
http://hackthissite.org
blueymaddog
Administrator
Administrator
blueymaddog


Posts : 1081
Join date : 2010-12-09
Age : 26

The Vector3.new() Function (and more) Empty
PostSubject: Re: The Vector3.new() Function (and more)   The Vector3.new() Function (and more) EmptyJanuary 20th 2011, 6:29 pm

I dunno. O.o
Back to top Go down
naknak
Administrator
Administrator
naknak


Posts : 878
Join date : 2010-07-30

The Vector3.new() Function (and more) Empty
PostSubject: Re: The Vector3.new() Function (and more)   The Vector3.new() Function (and more) EmptyJanuary 20th 2011, 7:11 pm

wait() always returns true
Back to top Go down
Supernapalm
Expert Scripter
Expert Scripter
avatar


Posts : 393
Join date : 2011-01-17

The Vector3.new() Function (and more) Empty
PostSubject: Re: The Vector3.new() Function (and more)   The Vector3.new() Function (and more) EmptyJanuary 20th 2011, 9:04 pm

oh. nvm. i was thinking something else.
Back to top Go down
http://hackthissite.org
myrco919
Intermediate Scripter
Intermediate Scripter
myrco919


Posts : 190
Join date : 2011-01-21
Age : 26
Location : Holland

The Vector3.new() Function (and more) Empty
PostSubject: Re: The Vector3.new() Function (and more)   The Vector3.new() Function (and more) EmptyJanuary 24th 2011, 9:48 am

v.Position = (((p.Position + v.Position)/2) + p.Position ^ 2)

:33
Back to top Go down
Supernapalm
Expert Scripter
Expert Scripter
avatar


Posts : 393
Join date : 2011-01-17

The Vector3.new() Function (and more) Empty
PostSubject: Re: The Vector3.new() Function (and more)   The Vector3.new() Function (and more) EmptyJanuary 24th 2011, 8:24 pm

what are you talking about?
Back to top Go down
http://hackthissite.org
CloneTrooper787
Moderator
Moderator
CloneTrooper787


Posts : 81
Join date : 2011-01-22

The Vector3.new() Function (and more) Empty
PostSubject: Re: The Vector3.new() Function (and more)   The Vector3.new() Function (and more) EmptyJanuary 25th 2011, 10:10 pm

@naknak- while true do
wait(10) --seems more formal to me than while wait(10) do
Back to top Go down
naknak
Administrator
Administrator
naknak


Posts : 878
Join date : 2010-07-30

The Vector3.new() Function (and more) Empty
PostSubject: Re: The Vector3.new() Function (and more)   The Vector3.new() Function (and more) EmptyJanuary 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.
Back to top Go down
CloneTrooper787
Moderator
Moderator
CloneTrooper787


Posts : 81
Join date : 2011-01-22

The Vector3.new() Function (and more) Empty
PostSubject: Re: The Vector3.new() Function (and more)   The Vector3.new() Function (and more) EmptyJanuary 25th 2011, 10:38 pm

Note to self: Size matters; Smaller is easier...
Back to top Go down
naknak
Administrator
Administrator
naknak


Posts : 878
Join date : 2010-07-30

The Vector3.new() Function (and more) Empty
PostSubject: Re: The Vector3.new() Function (and more)   The Vector3.new() Function (and more) EmptyJanuary 25th 2011, 10:39 pm

Smaller is easier IF you can handle it ;)
Back to top Go down
Supernapalm
Expert Scripter
Expert Scripter
avatar


Posts : 393
Join date : 2011-01-17

The Vector3.new() Function (and more) Empty
PostSubject: Re: The Vector3.new() Function (and more)   The Vector3.new() Function (and more) EmptyJanuary 25th 2011, 11:43 pm

but the disadvantage is that you must wait10) first. maybe this is what you want, maybe not.
Back to top Go down
http://hackthissite.org
blueymaddog
Administrator
Administrator
blueymaddog


Posts : 1081
Join date : 2010-12-09
Age : 26

The Vector3.new() Function (and more) Empty
PostSubject: Re: The Vector3.new() Function (and more)   The Vector3.new() Function (and more) EmptyJanuary 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")
Back to top Go down
blueymaddog
Administrator
Administrator
blueymaddog


Posts : 1081
Join date : 2010-12-09
Age : 26

The Vector3.new() Function (and more) Empty
PostSubject: Re: The Vector3.new() Function (and more)   The Vector3.new() Function (and more) EmptyJanuary 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
Back to top Go down
Supernapalm
Expert Scripter
Expert Scripter
avatar


Posts : 393
Join date : 2011-01-17

The Vector3.new() Function (and more) Empty
PostSubject: Re: The Vector3.new() Function (and more)   The Vector3.new() Function (and more) EmptyJanuary 27th 2011, 9:37 pm

how do you encrypt your script with lua?
Back to top Go down
http://hackthissite.org
blueymaddog
Administrator
Administrator
blueymaddog


Posts : 1081
Join date : 2010-12-09
Age : 26

The Vector3.new() Function (and more) Empty
PostSubject: Re: The Vector3.new() Function (and more)   The Vector3.new() Function (and more) EmptyFebruary 8th 2012, 4:59 am

one way is :byte()
Back to top Go down
Sponsored content





The Vector3.new() Function (and more) Empty
PostSubject: Re: The Vector3.new() Function (and more)   The Vector3.new() Function (and more) Empty

Back to top Go down
 
The Vector3.new() Function (and more)
Back to top 
Page 1 of 1
 Similar topics
-
» Vector3 BrickColor CFrame

Permissions in this forum:You cannot reply to topics in this forum
A Roblox Community :: Tutorials and Resources :: Beginner-
Jump to: