[Need Help] R6 Neck don't do rotate a head, but rotate the torso instead

  1. What do i want? :
    I want rigtype R6 head movement feature that following the Vertical direction of camera BUT within my custom first person camera(my cameratype is Scriptable, so i have scripting all behavior by myself) that locking the head too, So my HumanoidRootPart have to rotate in Horizontal direction of camera.

  2. So what is the issue/problem i encountering? :
    To rotate the head, Using the motor6d call “Neck”, right? But instead of rotating the Head Vertically, It just rotate the Torso Vertically that it should to just only rotate itself in Horizontal.

I was finding a cause of this issue by disable some of feature to test them if without it, Another one would work and this is result:
i was disable humanoidrootpart’s rotation

– Disabled : Hrp.CFrame = CFrame.new(Hrp.Position)*CFrame.fromOrientation(0,CameraRotation.X,0)

neck.C0 = CFrame.new(0,yOffset,0)*CFrame.Angles(math.asin(CameraLookDirection.Y) - math.rad(90),ry,rz)

head follow the camera feature was work normally.

another while i disable head follow the camera feature

Hrp.CFrame = CFrame.new(Hrp.Position)*CFrame.fromOrientation(0,CameraRotation.X,0)

– Disable : neck.C0 = CFrame.new(0,yOffset,0)*CFrame.Angles(math.asin(CameraLookDirection.Y) - math.rad(90),ry,rz)

humanoidrootpart rotate in Yaxis (Horizontal) ,So it was work normally too.

  1. What solutions have i tried so far? “Did you look for solutions on the Developer Hub?”
  • I tried move the neck’s parent into the head, and it doen’t solve anything
  • I tried use CFrame of neck’s Part1 (neck.C1) and of course it doesn’t solve

i was found this forum, he has simillar problem but it still don’t have anything that be solution for my problem i encountering.

For make you easier to hep me. here the code i wrote.

local RunService = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local CP = game:GetService("ContentProvider")

local Camera = workspace.CurrentCamera
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character.Humanoid

local Hrp = Character.PrimaryPart
local Head = Character.Head
local Torso = Character.Torso
local neck = Torso:FindFirstChild("Neck")

local FirstPersonCameraHandler = {}

-- ConfigureCameraSystem
FirstPersonCameraHandler.FieldOfView = 90
FirstPersonCameraHandler.AspectRatio = 1.5
FirstPersonCameraHandler.CameraSensinity = Vector2.new(0.020,0.020)
FirstPersonCameraHandler.unlockMouseButton = Enum.KeyCode.F

FirstPersonCameraHandler.Connection = {}

--FirstPersonCamera Config
local CameraRotation = Vector2.zero
local maxVecticalAngle = { Y = NumberRange.new(-math.rad(80),math.rad(80)) }

local CamOffset = Vector3.new(0,0.15,-1) 

local function UpdateCameraRotation(change)
	local mouseDelta = UIS:GetMouseDelta()
	
	CameraRotation =  Vector2.new(
		CameraRotation.X - mouseDelta.X * FirstPersonCameraHandler.CameraSensinity.X,
		math.clamp(
			CameraRotation.Y - mouseDelta.Y * FirstPersonCameraHandler.CameraSensinity.X,
			maxVecticalAngle.Y.Min,
			maxVecticalAngle.Y.Max
		)
	)
end

-- Method function
function FirstPersonCameraHandler:ChangeToFirstPersonView()
	CP:PreloadAsync(Character:GetDescendants())
	--[[
	Character.PrimaryPart = Hrp
	Head.Size = Vector3.new(1,1,1)
	neck.Parent = Head
	neck.Part0 = Character.Torso
	neck.Part1 = Character.Head
	neck.DesiredAngle = 0
	neck.MaxVelocity = 0
	Humanoid.AutoRotate = false
	wait()
	]]
	Camera.CameraType = Enum.CameraType.Scriptable
	UIS.MouseBehavior = Enum.MouseBehavior.LockCenter
	UIS.WindowFocused:Connect(function()
		UIS.MouseBehavior = Enum.MouseBehavior.LockCenter
	end)
	Player.CameraMinZoomDistance = 0.5
	Player.CameraMaxZoomDistance = 0.5
	Camera.FieldOfView = FirstPersonCameraHandler.FieldOfView
	SetLocalTransparencyOfCharacter(0)
	
	local yOffset = neck.C0.Y
	
	FirstPersonCameraHandler.Connection.CameraUpdate = 
		RunService:BindToRenderStep("CameraUpdated",Enum.RenderPriority.Camera.Value,function(dt)
			UpdateCameraRotation()
			 
			local CameraLookDirection = Camera.CFrame.LookVector
			
			local _,ry,rz = neck.C0:ToEulerAnglesXYZ()
			neck.C0 = CFrame.new(0,yOffset,0)*CFrame.Angles(math.asin(CameraLookDirection.Y) - math.rad(90),ry,rz) -- most of neccesary part of this topic
			
			local hrpY, hrpX, hrpZ = Hrp.CFrame:ToOrientation()
			local raw = Head.CFrame * CFrame.Angles(-hrpY,-hrpX,-hrpZ)
			local rot = CFrame.Angles(0,CameraRotation.X,0) * CFrame.Angles(CameraRotation.Y,0,0)
			
			Camera.CFrame = raw * rot * CFrame.new(0,0,5)
			Hrp.CFrame = CFrame.new(Hrp.Position)*CFrame.fromOrientation(0,CameraRotation.X,0) -- most of neccesary part of this topic
		end) 
end

Note: I wrote this script it in Module Script, So i tired my best to get neccessary code for showing

You can ask anything, If you confused anything about this topic but please help and try your best, Thank you.