local function T()local T={}T.TorsoLookPoint=nil function T.SetTorsoLookPoint(e,N)local E=findPlayerHumanoid(Player)if E then E.AutoRotate=false end T.TorsoLookPoint=N e:UpdateTorso()delay(2,function()if T.TorsoLookPoint==N then T.TorsoLookPoint=nil if E then E.AutoRotate=true end end end)end function T.UpdateTorso(e,N)if T.TorsoLookPoint then N=T.TorsoLookPoint else return end local E=findPlayerHumanoid(Player)local Z=E and E.Torso if Z then local T=(N-Z.CFrame.p).unit local e=(Vector3.new(T.X,0,T.Z)).unit Z.CFrame=CFrame.new(Z.CFrame.p,Z.CFrame.p+e)end end return T end local N=T()

local function CreateController()
	local this = {}

	this.TorsoLookPoint = nil

	function this:SetTorsoLookPoint(point)
		local humanoid = findPlayerHumanoid(Player)
		if humanoid then
			humanoid.AutoRotate = false
		end
		this.TorsoLookPoint = point
		self:UpdateTorso()
		delay(2,
			function()
			-- this isnt technically correct for detecting if this is the last issue to the setTorso function
			if this.TorsoLookPoint == point then
				this.TorsoLookPoint = nil
				if humanoid then
					humanoid.AutoRotate = true
				end
			end
		end)
	end

	function this:UpdateTorso(point)
		if this.TorsoLookPoint then
			point = this.TorsoLookPoint
		else
			return
		end

		local humanoid = findPlayerHumanoid(Player)
		local torso = humanoid and humanoid.Torso
		if torso then
			local lookVec = (point - torso.CFrame.p).unit
			local squashedLookVec = Vector3.new(lookVec.X, 0, lookVec.Z).unit
			torso.CFrame = CFrame.new(torso.CFrame.p, torso.CFrame.p + squashedLookVec)
		end
	end

	return this
end

local CharacterControl = CreateController()