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 subtract 1 from the X axis? [UPDATED]

What I'm wondering is how I remove 1 from 15 on a Position like Vector3.new(15, 16, 17)?

Help please.

2 comments

0

That's the X axis?

0

Oh wait, I meant X

2 answers

✓ Accepted answer

You can subtract Vectors,

local newPos = Vector3.new(15, 16, 17) - Vector3.new(1, 0, 0)

You can also add a negative number to subtract

local newPos = Vector3.new(15, 16, 17) + Vector3.new(-1, 0, 0)

This is not that hard to do. First, lets get the position of the Part:

game.Workspace.Part.Position

Now, we have the position of the part, so we want to get the position to equal something, and in this case, we want it to equal the same thing, by -1 on the X axis, so we would get the Position again and subtract it by a Vector3(1,0,0)

game.Workspace.Part.Position = game.Workspace.Part.Position - Vector3(1,0,0)

See, this is quite the easy task, it is subracting the Position by the numbers we gave.

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