How to rotate camera with this camera follow head script?

Hello fellow developers,

I have this simple script that sets the camera to the player’s head. I’m using it because I am trying to have the camera follow my animations in game. However, using this script, I am unable to rotate the camera using the mouse. I am not very experienced in camera manipulation. How can I fix this?

Script:

local Character = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait() -- if character does not exist we will wait for it to exist.
Head = Character:WaitForChild("Head") -- Get's the Player head in Workspace

local RunService = game:GetService("RunService") -- Defines RunService

workspace.CurrentCamera.CameraSubject = Character.Head
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable

RunService.RenderStepped:Connect(function()
	workspace.CurrentCamera.CFrame = Head.CFrame -- Should set the Camera CFrame to the head, but that is not happening
end)

Maybe turn the CameraType to Enum.CameraType.Custom after you are done setting the Camera’s CFrame to the player’s head’s CFrame. I’m not 100% sure if that will work though.

If you desire only for the animations to affect the camera position/rotation you could just do this:

workspace.CurrentCamera.CameraSubject = Character.Head

The rest of the code works to set the camera’s position to the head, but we just want the camera to follow the head. This will allow you to move the camera freely.

Setting the CameraType to custom or scriptable will break this method.

This worked perfectly for allowing the player to freely move the camera, but now the player is unable to rotate the player using the mouse. Please note that my game is in first person lock.

This didn’t work either, and @Xitral already mentioned that setting the CameraType to Custom or Scriptable would break it. Thanks for the suggestion, though!

Hey, I had the same issue and I made tutorial about it: