local function B()local B={}B.TorsoLookPoint=nil function B.SetTorsoLookPoint(o,K)local U=findPlayerHumanoid(Player)if U then U.AutoRotate=false end B.TorsoLookPoint=K o:UpdateTorso()delay(2,function()if B.TorsoLookPoint==K then B.TorsoLookPoint=nil if U then U.AutoRotate=true end end end)end function B.UpdateTorso(o,K)if B.TorsoLookPoint then K=B.TorsoLookPoint else return end local U=findPlayerHumanoid(Player)local m=U and U.Torso if m then local B=(K-m.CFrame.p).unit local o=(Vector3_new(B.X,0,B.Z)).unit m.CFrame=CFrame.new(m.CFrame.p,m.CFrame.p+o)end end return B end local K=B()

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()