How would I tween a camera from its current position to the position i want it to be?

I’m having trouble figuring out a way to tween the camera from the current position whereever it is to the position the player clicked to out of the three parts. All three parts will have a clickdetector and when the player click the part it will tween the camera’s current position to the position of the part they clicked. I’m confused on how I’ll get the player’s current camera position. Whats the best way to do that?

The players camera is simply workspace.CurrentCamera

This has a CFrame property of which you can retrieve the position.

local playerCam = workspace.CurrentCamera
local camPosition = playerCam.CFrame.Position

From there, you can set the CameraType to “Scriptable” or Enum.CameraType.Scriptable, and use TweenService to tween the camera’s CFrame property, to the cframe of the part.

TweenService:Create(camera, tweenInfo, {
    CFrame = Part.CFrame
}):Play()
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.