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

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

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?

1 comment

0

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

1 answer

✓ Accepted answer

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.

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