How to tween a model's position?

I am trying to tween a small truck to go from point A to point B. I did some research and most people said the best way to do this is to tween the primary part, then unanchor all of the other parts in the model and weld them to the primary part. For some reason this doesn’t work anymore, maybe has something to do with a recent studio update.

TweenService:Create(truck.PrimaryPart, TweenInfo.new(dist/2, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {Position = Vector3.new(SecondPos.X, SecondPos.Y + 1.2, SecondPos.Z)}):Play()

Here is what I currently have. What happens when I do this is only the primary part moves. The rest of the parts in the model just stay where they are even though they are welded to the primary part, and they are also unanchored.

Because you are tweening the Position property. If you want the other parts to move with it, you need to tween the CFrame property.

What I need to change in my code to do that?

You need to learn how TweenService works and then you will know.

What you’re doing here is moving the part to a new location.
The parent of the part (in your case, the model) is still in the exact same place. So if you put a print statement in the workspace, to see the position of the part, you will see that it’s moving. But the model itself is staying in the exact same location.
You need to move the model itself. Check out this picture:

In this picture, I’ve got a sphere and a block. I’ve parented the sphere to the block, and I’m moving the sphere.
What you can see here is that the sphere is moving, but the block isn’t.
What you need to do is move the block, not the sphere.

1 Like