First Person Y-Restricted Camera Issues

sorry if the title is awful, this is one of my first posts on the DevForum

Greetings,

I am a trying to script a first person camera that can not move along the y-axis. I set the CameraMaxZoomDistance in StarterPlayer to 0.5 (the minimum value). Then, using a LocalScript, I set the camera type to orbital. These changes put the camera in first person and successfully stopped the camera from moving up and and down. But, there were two issues that I couldn’t seem to fix:

1. You could NOT move the camera from side to side unless you were holding right click. I think this might have to do with orbital camera.

2. The Camera was pointed down at a weird angle. Illustrated in the below image:

The script I wrote is below:

local Workspace = game:GetService("Workspace")
local Camera = Workspace:WaitForChild("Camera")

local player = game.Players.LocalPlayer
local character = player.Character

Camera.CameraSubject = character:WaitForChild("Humanoid")
Camera.CameraType = Enum.CameraType.Orbital

Anyone know how to fix this?

I found this post:

and I couldn’t make sense of it. But I think that they were trying to achieve the same thing as me.

Roblox has a template that may give you what you need.

It’s called Line Runner and is available when you click on file new inside Roblox Studio.