Camera tweening back to player's original camera distance

Here’s a “cutscene” sequence I’m creating for my group:

At the end, you can see the camera tweens back towards the character’s head, then zooms out. I’d like to know how to solve this problem by having the camera tween to whatever zoom position the player was at before the cutscene takes place.

Here’s the code I used for tweening:

local tInfoStart = TweenInfo.new(
	2,
	Enum.EasingStyle.Quad,
	Enum.EasingDirection.InOut,
	0,
	false,
	0
)

function tweenCam(p1, p2)
	Camera.CFrame = p1

	local tween = TS:Create(Camera,tInfoStart, {CFrame = p2})
	tween:Play()
end

tweenCam(workspace.CutsceneSpots.CutsceneCamera.CFrame, character.Head.CFrame)
2 Likes

Before the cutscene remember the CFrame of the player’s camera, then when the cutscene ends tween it back to the remembered CFrame

-- before cutscene starts
local cameraPosition = workspace.CurrentCamera.CFrame

-- let cutscene play

-- then after cutscene ends
tweenCam(workspace.CutsceneSpots.CutsceneCamera.CFrame, cameraPosition)
3 Likes