How do i make the player not be able to rotate himself in first person?

Hello Scripters,

I want the player not to be able to rotate his camera in first person. (Like look around). I googled it but i found no way around to do it.

How can i do it?

can’t you just make the CameraType of the camera scriptable and in a heartbeat loop set the CFrame of the camera to the CFrame of the player’s head

This should do what you’re looking for.
It’s set to the CFrame of the HumanoidRootPart instead of the head to make sure it doesn’t wobble while you’re walking and it hides the part’s if the character to make sure your accessories are not in the view.
(local script in StarterCharacterScripts)

local RunService = game:GetService("RunService")

local character = script.Parent
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local camera = workspace.CurrentCamera

camera.CameraType = Enum.CameraType.Scriptable

for _, characterPart in character:GetDescendants() do
	if characterPart:IsA("BasePart") then
		characterPart.Transparency = 1
	end
end

RunService.Heartbeat:Connect(function()
	camera.CFrame = humanoidRootPart.CFrame + Vector3.new(0, 1.5, 0)
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.