Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Vector3 Positioning Help?

Asked by 9 years ago

How do i only change the value of y? I only want to change the value of 5, i don't want the brick to go in the middle of the baseplate, how do i make it so it stay's in the same position but ONLY changes the y value to 5? Thanks.

Script.Parent.Position=Vector3.new(0,5,0)

2 answers

Log in to vote
1
Answered by 9 years ago

Like this:

script.Parent.Position = script.Parent.Position +Vector3.new(0,5,0)

If you do it like you do, it goes in Vector3.new(0,5,0) in WorldSpace, when you use properties, you use WorldSpace and so you have to do it like this. That's why you have to use + on it. You also Should use CFrame if you want the Part to go only 5 upper, 'cause if player touches it, the position will not be same as my first example:

script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,5,0)

Also remember to write "script" with small letters.

0
Thankyou! QuantumScripter 48 — 9y
Ad
Log in to vote
1
Answered by 9 years ago

Just go like

script.Parent.Position = Vector3.new(script.Parent.Position.X,yPosition,script.Parent.Position.Z)

-- or

script.Parent.Position = script.Parent.Position + Vector3.new(0,yPosition,0)
0
... Why did you give me a minus? I answered your question... Those are the ways of doing it. You can't just thumbsdown me for asnwering lua questions. ObscureEntity 294 — 9y
0
I didn't give you a minus QuantumScripter 48 — 9y
0
Same thing. I answered your question in full. ObscureEntity 294 — 9y

Answer this question