local t=Character:WaitForChild("\072\117\109\097\110\111\105\100")local J=Character:WaitForChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")local a=Character:WaitForChild("\084\111\114\115\111")local f=a:WaitForChild("\078\101\099\107")local u=J:WaitForChild("\082\111\111\116\074\111\105\110\116")local R=a:WaitForChild("\082\105\103\104\116 \072\105\112")local v=a:WaitForChild("\076\101\102\116 \072\105\112")local G=v.C0 local P=R.C0 local m=f.C0 local s=u.C0 f.MaxVelocity=.33333333333333 RunService.RenderStepped:Connect(function()local t=Camera.CoordinateFrame if Character:FindFirstChild("\084\111\114\115\111")and Character:FindFirstChild("\072\101\097\100")then local t=a.CFrame.lookVector local J=Head.CFrame.p if f and u then if Camera.CameraSubject:IsDescendantOf(Character)or Camera.CameraSubject:IsDescendantOf(Player)then local a=PlayerMouse.Hit.p local o=(Head.CFrame.p-a).magnitude local F=Head.CFrame.Y-a.Y local k=CFrame.Angles(-(math.atan(F/o)*.5),((J-a).Unit:Cross(t)).Y*1,0)f.C0=(f.C0:lerp(k*m,.25)).Rotation+m.Position local y=-(math.atan(F/o)*.5)local L=((J-a).Unit:Cross(t)).Y*.5 local z=CFrame.Angles(y,L,0)local c=z*s u.C0=(u.C0:lerp(c,.25)).Rotation+s.Position local g=u.C0*s:Inverse()local K=g:Inverse()R.C0=K*P v.C0=K*G end end end end)

local Humanoid = Character:WaitForChild("Humanoid")
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")

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

local Waist = HumanoidRootPart:WaitForChild("RootJoint")

local RHip = Torso:WaitForChild("Right Hip")
local LHip = Torso:WaitForChild("Left Hip")

local LHipOriginC0 = LHip.C0
local RHipOriginC0 = RHip.C0

local NeckOriginC0 = Neck.C0
local WaistOriginC0 = Waist.C0

Neck.MaxVelocity = 1/3

RunService.RenderStepped:Connect(function() 
	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 and Waist 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

				local xAxisWaistRotation = -(math.atan(Difference / Distance) * 0.5)
				local yAxisWaistRotation = (((HeadPosition - Point).Unit):Cross(TorsoLookVector)).Y * 0.5
				local rotationWaistCFrame = CFrame.Angles(xAxisWaistRotation, yAxisWaistRotation, 0)
				local goalWaistCFrame = rotationWaistCFrame*WaistOriginC0
				Waist.C0 = Waist.C0:lerp(goalWaistCFrame, 0.5 / 2).Rotation + WaistOriginC0.Position


				local currentLegCounterCFrame = Waist.C0*WaistOriginC0:Inverse()

				local legsCounterCFrame = currentLegCounterCFrame:Inverse()

				RHip.C0 =  legsCounterCFrame*RHipOriginC0
				LHip.C0 = legsCounterCFrame*LHipOriginC0
			end
		end
	end	
end)
