Should I use TweenService or CFrame to move a part? Or something else?

Hi, I have a simple question. I just need to move a part from point A to point B. I would prefer it to be as performance efficient as possible while looking smooth, so should I tween the part,use CFrame, or something else? Thanks

1 Like

Whenever moving parts, you want to use body movers and constraints. Tweening is often done because it is simpler, but unanchored parts resting on top of a tweened part will not move with it.

2 Likes

You can Use BodyPosition to move it to the point a to point b

2 Likes

Are body movers more efficient than tweening or cframing? It’s only one part that will move at a time, however there will be many moving seperate parts

Also the BodyPosition page says to use AngularPosition, but the AngularPosition page isn’t there?

Read the API on Tweening, Body Position, and directly changing the position.
Body movers are relative to Physics.

2 Likes

I get there’s probably no straight answer, but maybe there’s a general consensus on what to use to be more efficient.

Do you happen to know whether physics or directly moving the part through a CFrame loop is better?

if your making the part teleport then change the position

if you want it to travel smoothly then use body movers or tweening

Yep it’s an apple and pears comparison question. They are different methods with different purposes and results.

TweenService/CFrame/Position editing

Pros:

  1. Reliable goes from start to goal without interuptions

  2. Multiple movement styles, using tween Info instead of linearly going from point A to B without much difficulty, perhaps using tween info EasingStyle | Roblox Creator Documentation to make it look elastic, springy, and cartoony.

Cons:

  1. Cannot physically interact with the enviroment (apply force) hence can be unrealistic (phases through walls, doesn’t carry people along with the part if standing on it)

Bodymovers/Physics

Pros:

  1. Physically interacts with the enviroment as force is given to a part (can push other parts)

Cons:

  1. Can be interupted due to various reasons (physics bugs, Get’s stuck on another part, perhaps friction reduces the speed and stops it moving altogether, even other players taking network ownership over the part when they get too close so exploiters can do flinging) so not always reliable from A to B.
  2. Implementing custom movement styles is more difficult as you cannot simply set a tween Info property.

However there are also mixed solution using both tween service and bodymovers like this minecart:

Possibilities are endless.

4 Likes

It totally depends on the case of use.
If you want to directly change the position just do that.

If you want to just move a part without caring just use Tween service.
For example, you want to move a part along the x axis.
now a player comes in front while the part moves to it’s desired position,if you are using body movers the part might be pushed back(Depending on the force from both sides)

If you use tween service in that scenario the part won’t be pushed back or stopped by the player who came in front but rather just travels to get to it’s position.

1 Like

Thank you! This is exactly what I was looking for. I’ll be using body movers