How to have the camera rotate with the player's relative rotation?

Basically I’m trying to make it so the camera moves along with the player being rotated. This is t he type of effect I want:
What I want

This is what the actual camera controller does:
What I want

Any tips?

Using Camera.CameraType we can set it to Enum.CameraType.Attach, and I think that’s the effect you want.

To have the camera rotate with the player’s relative rotation in Roblox, you can use the following steps:

  1. Create a new script in the workspace and name it “CameraScript.”
  2. In the script, create a variable to store the player’s character and assign it to the player’s character model:
local player = game.Players.LocalPlayer.Character
  1. Create a variable to store the camera and assign it to the current player’s camera:
local camera = game.Workspace.CurrentCamera
  1. In the script, create a function that will be called every frame to update the camera’s rotation:
function updateCamera()
    -- code to update the camera's rotation goes here
end
  1. In the updateCamera function, use the player’s HumanoidRootPart’s CFrame property to set the camera’s CFrame property. This will cause the camera to rotate with the player’s relative rotation:
camera.CFrame = player.HumanoidRootPart.CFrame
  1. To make the camera rotate smoothly, you can use the Lerp function to interpolate between the current camera rotation and the desired rotation. Replace the code in the updateCamera function with the following:
function updateCamera()
    camera.CFrame = camera.CFrame:Lerp(player.HumanoidRootPart.CFrame, 0.1)
end
  1. To call the updateCamera function every frame, you can use the RunService’s Heartbeat event. At the bottom of the script, add the following code:
game:GetService("RunService").Heartbeat:Connect(updateCamera)

This will cause the camera to smoothly rotate with the player’s relative rotation every frame.

however, wouldn’t attach stop the player from moving the camera themselves as well?

I tried to use the Camera/GetViewCFrame() and Camera/GetViewSize() to get the camera’s current settings, then Camera/SetViewCFrame() and Camera/SetViewSize() to change it, but that didn’t work.