Tweening without a static end goal

Lets say for example: I want to move this part from 75 studs to 85 studs in the x axis, smoothly with a tween

illustration

I could simply write:

TweenService:Create(game.workspace.part, tweenInfo.new(.5), {Position = Vector3.new(85, part.Position.Y, part.Position.Z)})

That’s all well and good, but what if i had other factors moving the part as well? and maybe I dont want to move it specifically to 85 studs, I just want to move it along the x axis by 10 studs. The tween will fight anything else that is effecting the part and it will not stop until the part reaches 85 studs on the x axis. How can I give it dynamic commands like “move by 10 studs” rather than “move to 85 studs on the x axis”?

4 Likes

You can use the part’s current position and add.

Example:
TweenService:Create(game.workspace.part, tweenInfo.new(.5), {Position = Vector3.new(part.Position.X + 10, part.Position.Y, part.Position.Z)})

2 Likes

Maybe insted of Tween use Force so u will have part that is moving to goal and part that position can be hanged and is a goal position for part

2 Likes

the part.Position.X + 10 will still just be interpreted as 75 studs + 10 = 85 studs, and will ultimately attempt to move the part to 85 studs. Over the course of the part’s movement, other factors may attempt to move the part as well. But the tween must ultimately end up at 85 studs by the nature of what it does, rather than just moving it my 10 studs

Here’s an example of what i mean. Lets say for example, I have a part that is positioned at 75 studs on the x axis, and I want to move it along by 10 more studs. Half way through the tween however, I have another script that says the part should be moved back to 0 studs on the x axis. The part has moved by 5 studs on the x axis so far, and should only have to move 5 more studs. But since the script moved the part back to 0 studs, the tween still has to have the part end up at 85 studs by the end of the tween. Ideally the part would only move the additional 5 studs resulting in an x position of 5 studs total, but instead the tween will speed up the movement of the part, ultimately resulting in the 85 stud goal.

1 Like

Alright then I believe there is no solution using TweenService. Perhaps this post could help answer your question, granted you may have to tweak it to your fitting of course.