Character is rotating wrong

local RunService = game:GetService("RunService")

local Player = game.Players.LocalPlayer
local PlayerMouse = Player:GetMouse()

local Camera = workspace.CurrentCamera

local LookController = {}
task.wait(1)

local Character = Player.Character or Player.CharacterAdded:Wait()

local Head = Character:WaitForChild("Head")

local Torso = Character:WaitForChild("Torso")
local Neck = Torso:WaitForChild("Neck")

local NeckOriginC0 = Neck.C0

Neck.MaxVelocity = 1/3

local function rotateHead()
	local CameraCFrame = Camera.CoordinateFrame

	if Character:FindFirstChild("Torso") and Character:FindFirstChild("Head") then
		local TorsoLookVector = Torso.CFrame.lookVector
		local HeadPosition = Head.CFrame.p

		if Neck then
			if Camera.CameraSubject:IsDescendantOf(Character) or Camera.CameraSubject:IsDescendantOf(Player) then
				local Point = PlayerMouse.Hit.p

				local Distance = (Head.CFrame.p - Point).magnitude
				local Difference = Head.CFrame.Y - Point.Y


				local goalNeckCFrame = CFrame.Angles(-(math.atan(Difference / Distance) * 0.5), (((HeadPosition - Point).Unit):Cross(TorsoLookVector)).Y * 1, 0)
				Neck.C0 = Neck.C0:lerp(goalNeckCFrame*NeckOriginC0, 0.5 / 2).Rotation + NeckOriginC0.Position
			end
		end
	end	
end

local primary = Character.PrimaryPart

local bodyGyro = Instance.new("BodyGyro")
bodyGyro.Parent = primary
bodyGyro.D = 40
bodyGyro.P = 10000
bodyGyro.MaxTorque = Vector3.new(4000000, 4000000, 4000000)

local function rayPlane(planepoint, planenormal, origin, direction)
	return -((origin-planepoint):Dot(planenormal))/(direction:Dot(planenormal))
end

local function rotateCharacter()
	local ray = Camera:ScreenPointToRay(PlayerMouse.X, PlayerMouse.Y)
	local t = rayPlane(Player.Character.Head.Position, Vector3.new(0, 1, 0), ray.Origin, ray.Direction)

	local primaryPos = primary.Position

	local plane_intersection_point = (ray.Direction * t) + ray.Origin
	bodyGyro.CFrame = CFrame.new(primaryPos, plane_intersection_point)
end

RunService.Stepped:Connect(function()
	rotateCharacter()
	rotateHead()
end)


return LookController

what is causing my character to rotate vertically like hes standing on his heels
https://gyazo.com/e1838431a0c4c0b83ebe9b8c2a2c52d5

Try making the plane along the characters primary part instead of the head, otherwise there will be a difference in height with the primaryPos and the plane along the head position causing it to look upwards.

rayPlane(primary.Position,

still the same issue, doesnt look like anything changed