How do I add `n` to a part's position?

I am messing around with TweenService(), and I am trying to create a moving part that, no matter it’s position, it will always move 10 studs on the x axis relative to the part’s position. To accomplish this, I need to “add” 10 to the part’s x axis coordinate.

I have tried the following:

local FrameTween = TweenService:Create(Frame, tweenInfo, {Position = Vector3.new(Frame.Position + 10, Frame.Position, Frame.Position)})

As well as

local FrameTween = TweenService:Create(Frame, tweenInfo, {Position = Vector3.xAxis(10)})

Trying any of these results in this error:

  20:57:09.548  Workspace.MovingPart.Script:17: attempt to call a Vector3 value  -  Server - Script:17

How do I add n to a part’s x axis?

Thanks in advance,
USER_UNKNOWN

The Vector3 decomposes into X, Y and Z, to add 10 to X you have to split the vector and add it to just X, or you can also do this

local FrameTween = TweenService:Create(Frame, tweenInfo, {Position = Frame.Position + Vector3.new(10, 0, 0)})
1 Like