How to turn a part slightly towards another part, but not completely

This is a little hard to explain, but i’ll try. I have a shark NPC, that chases the player and uses CFrame.LookAt.

SharkModel.PrimaryPart.CFrame = CFrame.lookAt(SharkModel.PrimaryPart.Position,part)

However, the shark is turning too sharply. It can rotate instantly, and I don’t want that. How could I make it turn slowly? I know I could use tween service, but that would only make it relatively slower (if it wanted to rotate 100 degrees, it would take the same amount of time as if it rotated 10). Are there any other ways I could do this? Thank you!

You can use lerping to partially transform towards another CFrame.

SharkModel.PrimaryPart.CFrame = CFrame:Lerp(CFrame.lookAt(SharkModel.PrimaryPart.Position, part), 0.1)
-- with 0.1, it goes 10% of the way each time this line of code runs

You can use this to achieve a slow rotation if you repeat the change multiple times with a delay in between. Though, it might look choppy if the delay is long.

If you wanted a proper smooth rotation, you would need to have a tween that changes duration depending on how far the rotation is. I don’t really know how to do that, but I assume it involves getting the orientations of the origin and target rotations and adding up the rotational differences on each axis to get a number describing the total difference, which you can then multiply by a constant rotation speed multiplier to get the tween time.