Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Vector3 Positioning Help?

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

✓ Accepted answer

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.

1 comment

0

Thankyou!

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)

3 comments

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.

0

I didn't give you a minus

0

Same thing. I answered your question in full.

This discussion is preserved as it was. New answers, comments, and votes are closed.