How can I make my camera face the player?

Hello. I’ve been struggling with making my camera face the player as of late. Note: All code works, the positioning is just off.

camera.CameraSubject = game.Workspace
camera.CameraType = "Scriptable"
camera.CFrame = CFrame.new(0,100,0)
menuGUI.Enabled = true

newGameButton.Activated:Connect(function()
	menuGUI.Enabled = false
	local CCE = Instance.new("ColorCorrectionEffect")
	CCE.Parent = camera
	local fadeTweenInfo = TweenInfo.new(3,Enum.EasingStyle.Linear, Enum.EasingDirection.Out,0,false,0)
	local fadeTweenGoal = {TintColor = Color3.new(0,0,0)}
	local playFadeTween = tweenService:Create(CCE, fadeTweenInfo, fadeTweenGoal)
	local unfadeTweenInfo = TweenInfo.new(3,Enum.EasingStyle.Linear, Enum.EasingDirection.Out,0,false,0)
	local unfadeTweenGoal = {TintColor = Color3.new(1,1,1)}
	local playUnfadeTween = tweenService:Create(CCE, unfadeTweenInfo, unfadeTweenGoal)
--	Player screen fades to Black. Once done, teleports the player before setting the camera to look at the player.
	playFadeTween:Play()
	playFadeTween.Completed:Connect(function()
		local playerCoords = game.ReplicatedStorage.Remotes.newGameTeleport:InvokeServer()
		camera.CFrame = CFrame.new() --Need help here.
		playUnfadeTween:Play()
	end)
end)
1 Like

Could you include an image showing what’s actually off about it?

Nothing is ‘Off’ about it. I’m just wondering as to how I can automatically make my camera face the player.

If you want the camera to face the player from it’s current position, you can do this:
workspace.CurrentCamera.CFrame = CFrame.new(workspace.CurrentCamera.CFrame.Position, character.HumanoidRootPart.CFrame.Position)

It does this:

I presume you are using runservice alongside that?

Pretty much, use RunService.RenderStepped.

Yup, I use BindToRenderStep at priority Enum.RenderPriority.Camera.Value - 1. This is much smoother than heartbeat or renderstepped as it updates right before the camera updates, so as soon as the camera updates, the cframe will already be changed making tracking perfect.