Trying to tween the camera to look at a part

I made something similar to this but i recently started learning about tweening.
My old system of this just made the camera snap to the part, but i want it to actually move to it as if you are looking at it

Current attemp at doing it:

-- Tweens --
local FocusInfo = TweenInfo.new(1, Enum.EasingStyle.Back)
local Focus = tweenservice:Create(cam, FocusInfo, {Orientation = Screen.CFrame.Position})

My error:
TweenService:Create no property named ‘Orientation’ for object ‘Camera’

Idk how to tween like this, i only know how to do transparency, size, ect
Stuff with simple parameters.

Now what you might be saying is “just make the camera move to a specific location”
I cant do that, because the part moves.

Thanks for any help! my scripter is on vacation and cant help me right now.

1 Like

Use CFrame for the camera rather than Vector3 (orientation).

local tween = tweenService:Create(camera, info, {CFrame = camera.CFrame:lookAt(part.CFrame)})

1 Like

lookAt is not a valid member of CFrame
I got an error

1 Like

Use “:” not “.” When calling a method

1 Like

I didnt use “.”
Heres the tween:

local Focus = tweenservice:Create(cam, FocusInfo, {CFrame = cam.CFrame:lookAt(Screen.CFrame)})
1 Like

Ah, thats mb. The goal of the tween should be CFrame.lookAt(position1, position2)

1 Like

ill check if it works later, for now ill mark as solution

Just relized, the part like i said moves, so i cant just make it look at a specific location

Try lerping the cameras cframe instead.