How can I add to Position instead of setting it?

Hello developers!

I know this may be the wrong category, but I want to ask something.

How can I tween Position this way: Position += Vector3.new(0,5,0)
What I’m trying to achieve is adding 5 to the Y axis instead of having to get the actual position of the part since when I will try and move it the tween will just screw itself up and I’ll have to yet again change position.

Example

image

Thanks for reading! Waiting for a reply.

1 Like

local DoorTweenCloseGoals1 = {
    Position = Vector3.new(-37.55,5.5,-19.55)
}
local DoorTweenCloseGoals1 = {
    Position = Vector3.new(-37.55,5.5,-19.55) + Vector3.new(1,1,1)
}

Why dont you do smth like this?

1 Like

So if you want to use TweenService, you would do this.

Personally I would use CFrame, because its better:

local TweenService = game:GetService("TweenService")
local PartToTween = workspace.PartToMove

local tweenSettings = TweenInfo.new(1, Enum.EasingStyle.Quint, Enum.EasingDirection.Out)
local newTween = TweenService:Create(PartToTween, tweenSettings, {CFrame = CFrame.new(PartToTween.Position + Vector3.new(5,0,5))})
newTween:Play()
3 Likes

Do you want me to write code for your supplied example?

If you think that’s good enough for me, then sure! Or I could just find myself a way.

Alright! Going to test it and see if it works.

'Cause I no longer want to have to edit the Position value every time I move the part. Even if it adds to the Vector3 value, I’ll still have to edit the first Vector3 value, which makes this method useless. Thanks for helping btw!

Yoooo! It works! Thank you so much! You’re my hero! :slight_smile:

No worries :blush:
[30 limit………………]

1 Like