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

How do I save a parts position as a Vector3 variable then change one of the numbers later?

Asked by 4 years ago

I want to do

Pos = part.Position

Then I want to change the x and z value. How could I do this?

Or

Could I convert the Vector3 value to 3 different variables?

0
Pos = vector3.new(x, y, z) WideSteal321 773 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Firstly, you would want to save each individual position point so x, y, z Like this

local x = pos.x
local y = pos.y
local z = pos.x

Now you can change x, y or z at anytime, but they are by default the parts position.

To change them you would need to do something like this:

x = 2
y = y -3
— etc.

Finally, to set that as it’s position use:

pos = vector3.new(x, y, z)

Note: it’s almost midnight and I will not respond to comments for about 8 hours.

Ad

Answer this question