(game:GetService("\082\117\110\083\101\114\118\105\099\101")).Heartbeat:Connect(function()rWait(UpdateDelay)local Q=Trso.CFrame.lookVector local Y=Head.CFrame.p local G=getClosestPlayer()local L if Neck or Waist then if G then local H,j=pcall(function()L=GetValidPartToLookAt(G,PartToLookAt)if L then local H=nil local j=nil local i=(Core.CFrame:ToObjectSpace(L.CFrame)).Z<0 if i then if LookingAtValue.Value~=G then LookingAtValue.Value=G end H=(Head.CFrame.p-L.CFrame.p).magnitude j=Head.CFrame.Y-L.CFrame.Y if not IsR6 then LookAt(NeckOrgnC0*Ang(-(aTan(j/H)*HeadVertFactor),((Y-L.CFrame.p).Unit:Cross(Q)).Y*HeadHorFactor,0),WaistOrgnC0*Ang(-(aTan(j/H)*BodyVertFactor),((Y-L.CFrame.p).Unit:Cross(Q)).Y*BodyHorFactor,0))else LookAt(NeckOrgnC0*Ang(aTan(j/H)*HeadVertFactor,0,((Y-L.CFrame.p).Unit:Cross(Q)).Y*HeadHorFactor))end elseif LookBackOnNil then LookAt(NeckOrgnC0,WaistOrgnC0)if LookingAtValue.Value then LookingAtValue.Value=nil end end end end)elseif LookBackOnNil then LookAt(NeckOrgnC0,WaistOrgnC0)if LookingAtValue.Value then LookingAtValue.Value=nil end end end end)
--------------------------------------------

game:GetService("RunService").Heartbeat:Connect(function()
	rWait(UpdateDelay)
	local TrsoLV = Trso.CFrame.lookVector
	local HdPos = Head.CFrame.p
	local player = getClosestPlayer()
	local LookAtPart
	if Neck or Waist then
		if player then
			local success, err = pcall(function()
				LookAtPart = GetValidPartToLookAt(player, PartToLookAt)
				if LookAtPart then
					local Dist = nil
					local Diff = nil
					local is_in_front = Core.CFrame:ToObjectSpace(LookAtPart.CFrame).Z < 0
					if is_in_front then
						if LookingAtValue.Value ~= player then
							LookingAtValue.Value = player
						end

						Dist = (Head.CFrame.p - LookAtPart.CFrame.p).magnitude
						Diff = Head.CFrame.Y - LookAtPart.CFrame.Y

						if not IsR6 then
							LookAt(
								NeckOrgnC0
									* Ang(
										-(aTan(Diff / Dist) * HeadVertFactor),
										(((HdPos - LookAtPart.CFrame.p).Unit):Cross(TrsoLV)).Y * HeadHorFactor,
										0
									),
								WaistOrgnC0
									* Ang(
										-(aTan(Diff / Dist) * BodyVertFactor),
										(((HdPos - LookAtPart.CFrame.p).Unit):Cross(TrsoLV)).Y * BodyHorFactor,
										0
									)
							)
						else
							LookAt(
								NeckOrgnC0
									* Ang(
										(aTan(Diff / Dist) * HeadVertFactor),
										0,
										(((HdPos - LookAtPart.CFrame.p).Unit):Cross(TrsoLV)).Y * HeadHorFactor
									)
							)
						end
					elseif LookBackOnNil then
						LookAt(NeckOrgnC0, WaistOrgnC0)
						if LookingAtValue.Value then
							LookingAtValue.Value = nil
						end
					end
				end
			end)
		elseif LookBackOnNil then
			LookAt(NeckOrgnC0, WaistOrgnC0)
			if LookingAtValue.Value then
				LookingAtValue.Value = nil
			end
		end
	end
end)
