Fixing the camera above the player, but have the front face of the part pointing at them

I want the camera to 2D, above the player’s head and rotated at them on a 45 degree angle. I have made it 2D but not in the way I want it, any suggestions?

I tried using a camera part but that didn’t work since it shook a lot. I also tried using the camera part in a view-model, which also didn’t work. Now I’m here with

Here is my code:

local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera


camera.CameraSubject = player.Character.HumanoidRootPart
camera.CameraType = Enum.CameraType.Attach
camera.FieldOfView = 40

local RunService = game:GetService("RunService")

local function onUpdate()
    if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
		camera.CFrame = *,0,30)
RunService:BindToRenderStep("Camera", Enum.RenderPriority.Input.Value, onUpdate)
1 Like
camera.CFrame = *, 30 / math.sqrt(2), 30 / math.sqrt(2)) * CFrame.Angles(math.pi / 4, 0, 0)


If we want to be 30 studs away at a 45 degree angle, we have to go back 30/sqrt(2) studs and up 30/sqrt(2) studs. You can prove it to yourself by using the Pythagorean theorem that (30/sqrt(2))^2 + (30/sqrt(2))^2 = 30^2. And for the CFrame.Angles part, math.pi / 4 is equal to 45 degrees but in radians.

EDIT: Could probably simplify this a little with vectors.

camera.CFrame = +, 30 / math.sqrt(2), 30 / math.sqrt(2))) * CFrame.Angles(math.pi / 4, 0, 0)
1 Like

Thanks! Now this makes sense to me.