if TurnCharacterToMouse==true then MseGuide=true HeadHorFactor=0 BodyHorFactor=0 end Bind=function(c)Head=c:WaitForChild("\072\101\097\100")Hum=c:WaitForChild("\072\117\109\097\110\111\105\100")Core=c:WaitForChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")IsR6=Hum.RigType.Value==0 Trso=IsR6 and c:WaitForChild("\084\111\114\115\111")or c:WaitForChild("\085\112\112\101\114\084\111\114\115\111")Neck=IsR6 and Trso:WaitForChild("\078\101\099\107")or Head:WaitForChild("\078\101\099\107")Waist=not IsR6 and Trso:WaitForChild("\087\097\105\115\116")local A=Neck.C0 local p=not IsR6 and Waist.C0 Neck.MaxVelocity=.33333333333333 local l l=(game:GetService("\082\117\110\083\101\114\118\105\099\101")).RenderStepped:Connect(function()if not c then l:Disconnect()return end local u=Cam.CoordinateFrame if(IsR6 and c.Torso or c.UpperTorso)~=nil and c.Head~=nil then local l=Trso.CFrame.lookVector local I=Head.CFrame.p if IsR6 and Neck or Neck and Waist then if Cam.CameraSubject:IsDescendantOf(c)or Cam.CameraSubject:IsDescendantOf(Plr)then local c=nil local Z=nil if not MseGuide then c=(Head.CFrame.p-u.p).magnitude Z=Head.CFrame.Y-u.Y if not IsR6 then Neck.C0=Neck.C0:lerp(A*Ang(aSin(Z/c)*HeadVertFactor,-((I-u.p).Unit:Cross(l)).Y*HeadHorFactor,0),UpdateSpeed/2)Waist.C0=Waist.C0:lerp(p*Ang(aSin(Z/c)*BodyVertFactor,-((I-u.p).Unit:Cross(l)).Y*BodyHorFactor,0),UpdateSpeed/2)else Neck.C0=Neck.C0:lerp(A*Ang(-(aSin(Z/c)*HeadVertFactor),0,-((I-u.p).Unit:Cross(l)).Y*HeadHorFactor),UpdateSpeed/2)end else local u=Mouse.Hit.p c=(Head.CFrame.p-u).magnitude Z=Head.CFrame.Y-u.Y if not IsR6 then Neck.C0=Neck.C0:lerp(A*Ang(-(aTan(Z/c)*HeadVertFactor),((I-u).Unit:Cross(l)).Y*HeadHorFactor,0),UpdateSpeed/2)Waist.C0=Waist.C0:lerp(p*Ang(-(aTan(Z/c)*BodyVertFactor),((I-u).Unit:Cross(l)).Y*BodyHorFactor,0),UpdateSpeed/2)else Neck.C0=Neck.C0:lerp(A*Ang(aTan(Z/c)*HeadVertFactor,0,((I-u).Unit:Cross(l)).Y*HeadHorFactor),UpdateSpeed/2)end end end end end if TurnCharacterToMouse==true then Hum.AutoRotate=false Core.CFrame=Core.CFrame:lerp(CFrame.new(Core.Position,Vector3.new(Mouse.Hit.p.x,Core.Position.Y,Mouse.Hit.p.z)),UpdateSpeed/2)else Hum.AutoRotate=true end end)end repeat task.wait()until Plr.Character Bind(Plr.Character)Plr.CharacterAdded:Connect(Bind)
-- Activation]:
if TurnCharacterToMouse == true then
	MseGuide = true
	HeadHorFactor = 0
	BodyHorFactor = 0
end

Bind = function(Body)
	Head = Body:WaitForChild("Head")
	Hum = Body:WaitForChild("Humanoid")
	Core = Body:WaitForChild("HumanoidRootPart")
	IsR6 = (Hum.RigType.Value == 0) --[Checking if the player is using R15 or R6.]
	Trso = (IsR6 and Body:WaitForChild("Torso")) or Body:WaitForChild("UpperTorso")
	Neck = (IsR6 and Trso:WaitForChild("Neck")) or Head:WaitForChild("Neck") --[Once we know the Rig, we know what to find.]
	Waist = (not IsR6 and Trso:WaitForChild("Waist")) --[R6 doesn't have a waist joint, unfortunately.]

	local NeckOrgnC0 = Neck.C0 --[Get the base C0 to manipulate off of.]
	local WaistOrgnC0 = (not IsR6 and Waist.C0) --[Get the base C0 to manipulate off of.]

	--[Setup]:
	Neck.MaxVelocity = 1 / 3

	local Connection
	Connection = game:GetService("RunService").RenderStepped:Connect(function()
		if not Body then
			Connection:Disconnect()
			return
		end

		local CamCF = Cam.CoordinateFrame

		if ((IsR6 and Body["Torso"]) or Body["UpperTorso"]) ~= nil and Body["Head"] ~= nil then --[Check for the Torso and Head...]
			local TrsoLV = Trso.CFrame.lookVector
			local HdPos = Head.CFrame.p
			if IsR6 and Neck or Neck and Waist then --[Make sure the Neck still exists.]
				if Cam.CameraSubject:IsDescendantOf(Body) or Cam.CameraSubject:IsDescendantOf(Plr) then
					local Dist = nil
					local Diff = nil
					if not MseGuide then --[If not tracking the Mouse then get the Camera.]
						Dist = (Head.CFrame.p - CamCF.p).magnitude
						Diff = Head.CFrame.Y - CamCF.Y
						if not IsR6 then --[R6 and R15 Neck rotation C0s are different; R15: X axis inverted and Z is now the Y.]
							Neck.C0 = Neck.C0:lerp(
								NeckOrgnC0
									* Ang(
										(aSin(Diff / Dist) * HeadVertFactor),
										-(((HdPos - CamCF.p).Unit):Cross(TrsoLV)).Y * HeadHorFactor,
										0
									),
								UpdateSpeed / 2
							)
							Waist.C0 = Waist.C0:lerp(
								WaistOrgnC0
									* Ang(
										(aSin(Diff / Dist) * BodyVertFactor),
										-(((HdPos - CamCF.p).Unit):Cross(TrsoLV)).Y * BodyHorFactor,
										0
									),
								UpdateSpeed / 2
							)
						else --[R15s actually have the properly oriented Neck CFrame.]
							Neck.C0 = Neck.C0:lerp(
								NeckOrgnC0
									* Ang(
										-(aSin(Diff / Dist) * HeadVertFactor),
										0,
										-(((HdPos - CamCF.p).Unit):Cross(TrsoLV)).Y * HeadHorFactor
									),
								UpdateSpeed / 2
							)
						end
					else
						local Point = Mouse.Hit.p
						Dist = (Head.CFrame.p - Point).magnitude
						Diff = Head.CFrame.Y - Point.Y
						if not IsR6 then
							Neck.C0 = Neck.C0:lerp(
								NeckOrgnC0
									* Ang(
										-(aTan(Diff / Dist) * HeadVertFactor),
										(((HdPos - Point).Unit):Cross(TrsoLV)).Y * HeadHorFactor,
										0
									),
								UpdateSpeed / 2
							)
							Waist.C0 = Waist.C0:lerp(
								WaistOrgnC0
									* Ang(
										-(aTan(Diff / Dist) * BodyVertFactor),
										(((HdPos - Point).Unit):Cross(TrsoLV)).Y * BodyHorFactor,
										0
									),
								UpdateSpeed / 2
							)
						else
							Neck.C0 = Neck.C0:lerp(
								NeckOrgnC0
									* Ang(
										(aTan(Diff / Dist) * HeadVertFactor),
										0,
										(((HdPos - Point).Unit):Cross(TrsoLV)).Y * HeadHorFactor
									),
								UpdateSpeed / 2
							)
						end
					end
				end
			end
		end
		if TurnCharacterToMouse == true then
			Hum.AutoRotate = false
			Core.CFrame = Core.CFrame:lerp(
				CFrame.new(Core.Position, Vector3.new(Mouse.Hit.p.x, Core.Position.Y, Mouse.Hit.p.z)),
				UpdateSpeed / 2
			)
		else
			Hum.AutoRotate = true
		end
	end)
end

repeat
	task.wait()
until Plr.Character
Bind(Plr.Character)

Plr.CharacterAdded:Connect(Bind)
