How to set up a sequence of part tween positions

I have started to learn about tweening objects however, I am wondering how I would make it so a part would follow a set pathway with tweens. For example:
I want to make a part go forwards until it hits the assigned vector3, then I want the part to move right until it hits the set vector3.

local TweenService = game:GetService("TweenService")

local part = script.Parent

local tweenInfo = TweenInfo.new(

1, -- Time

Enum.EasingStyle.Linear, -- EasingStyle

Enum.EasingDirection.Out, -- EasingDirection

-1, -- RepeatCount (when less than zero the tween will loop indefinitely)

false, -- Reverses (tween will reverse once reaching it's goal)

0 -- DelayTime

)

local tween = TweenService:Create(part, tweenInfo, {Size = Vector3.new(20, 20, 40), Orientation = Vector3.new(0, 360, 0)})

tween:Play()

Yes, this is completely ripped off of the developer hubs wiki page because I’m trying to understand how this works and expand my knowledge of tweening parts.

This question might not make much sense since this is a type of question that I don’t understand how to properly word, apologies if that is the case.

2 Likes

Forgive me if I am wrong(I may not fully understand the question) but I believe what you can do is just tween the assigned Vector3,add a tween.Completed:wait()(This makes it so the code waits until the tween has reached its assigned goal) and then start the second tween that goes right. Hopefully I worded that correctly. This would require two tweens though both with assigned vector3 goals.

3 Likes

I don’t understand much about tweening so is this right?:
local TweenService = game:GetService(“TweenService”)

local part = script.Parent

local tweenInfo = TweenInfo.new(

1, -- Time

Enum.EasingStyle.Linear, -- EasingStyle

Enum.EasingDirection.Out, -- EasingDirection

1, -- RepeatCount (when less than zero the tween will loop indefinitely)

false, -- Reverses (tween will reverse once reaching it's goal)

0 -- DelayTime

)

local tween = TweenService:Create(part, tweenInfo, {Size = Vector3.new(20, 20, 40), Orientation = Vector3.new(0, 360, 0)})

tween:Play()

tween.Completed:wait()

print("Completed")

(completed is just a test for it to print) The issue is it doesn’t seem to run at all now.
Also, sorry if I seem lazy or rushed in any way it’s 11, I’m tired and probably shouldn’t be using the dev forum but here I am.

1 Like

Nevermind, some of the script was broken. I’m going to not post in here for a while now since I’m too tired to attempt things solo or even post in the dev forum. Thank you for the help though.

1 Like

Okay! Hey don’t be scared to post if you need help, just make sure to always look before posting someone may of made a similar post!(Not saying someone has made a post about your question just in general). Best of luck with the script! Sorry if I confused you!

2 Likes

You didn’t confuse me, sleep deprivation did that. I’m not scared to post in here(you guys all are great at helping people) just I’m scared that I’m going to seem extremely stupid when tired. I love posting in here since I usually get excellent and informative responses.
Am I allowed to post a comment about a question relevant to tweening with colours in here or do I need to DM it.(if so can I dm you this question)

1 Like