Hey everyone! The title says it all.
This script works while in third-person, but once the player goes first-person the angle lock does not work anymore. No idea how to fix it…
local Player = game.Players.LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait()
local RootPart = Char:WaitForChild("HumanoidRootPart")
local Camera = workspace.CurrentCamera
local RS = game:GetService("RunService")
local LimitAxis = RS.Heartbeat:Connect(function()
local CameraCFrame = RootPart.CFrame:ToObjectSpace(Camera.CFrame)
local x, y, z = CameraCFrame:ToOrientation()
local a = Camera.CFrame.Position.X
local b = Camera.CFrame.Position.Y
local c = Camera.CFrame.Position.Z
local ylimit = math.rad(math.clamp(math.deg(y), -30, 30))
Camera.CFrame = RootPart.CFrame:ToWorldSpace(CFrame.new(a,b,c) * CFrame.fromOrientation(x,ylimit,z))
end)