Add in cframe w/360 support for tracking. and clearance.

```
-- Services
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local Workspace = game:GetService("Workspace")

-- Configuration
local ROTATION_SPEED = 5  -- Increased speed for smoother and quicker rotation
local TRACKED_TARGET = nil -- Currently tracked target (player or model with humanoid)
local ESP_INDICATOR_NAME = "TargetESP"
local TARGET_VISUAL_NAME = "TargetVisual"

local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local playerGui = player:WaitForChild("PlayerGui")

-- Tables to keep track of ESP indicators and visuals
local espIndicators = {}
local targetVisuals = {}

-- Function to check if a model has a humanoid
local function hasHumanoid(model)
    return model:FindFirstChildOfClass("Humanoid") ~= nil
end

-- Function to handle clicking on a model to target or deselect it
local function onModelClicked(targetModel)
    if TRACKED_TARGET == targetModel then
        -- Deselect the current target
        TRACKED_TARGET = nil
    else
        -- Select the new target and deselect the previous one
        TRACKED_TARGET = targetModel
    end
end

-- Function to perform a line of sight check between two points
local function hasClearLine(startPos, endPos)
    local direction = endPos - startPos
    local ray = Ray.new(startPos, direction.unit * direction.magnitude)
    local hitPart, hitPosition = Workspace:FindPartOnRay(ray, character, false, true)
    if hitPart then
        -- If the hit part is part of the target, the line is clear
        return hitPart:IsDescendantOf(TRACKED_TARGET)
    end
    return false
end

-- Function to smoothly face the target using Heartbeat
local function smoothFaceTargetHeartbeat(targetModel, deltaTime)
    if targetModel and targetModel:FindFirstChild("HumanoidRootPart") then
        local targetHumanoidRootPart = targetModel:FindFirstChild("HumanoidRootPart")
        if targetHumanoidRootPart then
            local targetPosition = targetHumanoidRootPart.Position
            -- Check for line of sight
            if hasClearLine(humanoidRootPart.Position, targetPosition) then
                local direction = (targetPosition - humanoidRootPart.Position).Unit
                local currentLookVector = humanoidRootPart.CFrame.LookVector
                local desiredLookVector = Vector3.new(direction.X, 0, direction.Z) -- Keep y-axis rotation flat

                -- Calculate the rotation step
                local rotationStep = ROTATION_SPEED * deltaTime
                local newLookVector = currentLookVector:Lerp(desiredLookVector, rotationStep).Unit

                -- Create the new CFrame with the interpolated look vector
                humanoidRootPart.CFrame = CFrame.new(humanoidRootPart.Position, humanoidRootPart.Position + newLookVector)
            end
        end
    end
end

-- Function to create or update ESP indicator
local function updateESP(targetModel)
    if not targetModel then return end
    local targetHead = targetModel:FindFirstChild("Head")
    if targetHead then
        if not espIndicators[targetModel] then
            -- Create ESP BillboardGui
            local billboard = Instance.new("BillboardGui")
            billboard.Name = ESP_INDICATOR_NAME
            billboard.Adornee = targetHead
            billboard.Size = UDim2.new(0, 100, 0, 50)
            billboard.StudsOffset = Vector3.new(0, 2, 0)
            billboard.AlwaysOnTop = true

            local textLabel = Instance.new("TextLabel")
            textLabel.Size = UDim2.new(1, 0, 1, 0)
            textLabel.Text = "Targeted"
            textLabel.TextColor3 = Color3.fromRGB(255, 0, 0)
            textLabel.BackgroundTransparency = 1
            textLabel.TextStrokeTransparency = 0.8
            textLabel.Parent = billboard

            billboard.Parent = playerGui

            espIndicators[targetModel] = billboard
        end
    end
end

-- Function to remove ESP indicator
local function removeESP(targetModel)
    if espIndicators[targetModel] then
        espIndicators[targetModel]:Destroy()
        espIndicators[targetModel] = nil
    end
end

-- Function to create a visual indicator at the target's position
local function updateTargetVisual(targetModel)
    if not targetModel then return end
    local rootPart = targetModel:FindFirstChild("HumanoidRootPart")
    if rootPart then
        if not targetVisuals[targetModel] then
            -- Create a circle or other visual indicator
            local part = Instance.new("Part")
            part.Name = TARGET_VISUAL_NAME
            part.Anchored = true
            part.CanCollide = false
            part.Size = Vector3.new(5, 0.2, 5)
            part.Position = Vector3.new(rootPart.Position.X, rootPart.Position.Y - 1, rootPart.Position.Z)
            part.BrickColor = BrickColor.new("Bright red")
            part.Transparency = 0.7
            local mesh = Instance.new("CylinderMesh")
            mesh.Parent = part
            part.Parent = Workspace

            targetVisuals[targetModel] = part
        else
            -- Update position
            local part = targetVisuals[targetModel]
            local rootPart = targetModel:FindFirstChild("HumanoidRootPart")
            if rootPart then
                part.Position = Vector3.new(rootPart.Position.X, rootPart.Position.Y - 1, rootPart.Position.Z)
            end
        end
    end
end

-- Function to remove target visual
local function removeTargetVisual(targetModel)
    if targetVisuals[targetModel] then
        targetVisuals[targetModel]:Destroy()
        targetVisuals[targetModel] = nil
    end
end

-- Function to clear all ESP and visuals
local function clearAllIndicators()
    for target, billboard in pairs(espIndicators) do
        billboard:Destroy()
    end
    espIndicators = {}

    for target, visual in pairs(targetVisuals) do
        visual:Destroy()
    end
    targetVisuals = {}
end

-- Function to update visuals based on current target
local function updateVisuals()
    -- Clear previous ESP and visuals
    clearAllIndicators()

    if TRACKED_TARGET then
        updateESP(TRACKED_TARGET)
        updateTargetVisual(TRACKED_TARGET)
    end
end

-- Function to handle the rotation towards target each heartbeat
local function trackTarget(deltaTime)
    if TRACKED_TARGET then
        smoothFaceTargetHeartbeat(TRACKED_TARGET, deltaTime)
    end
end

-- Listen for player clicks to target or deselect a model
local function onInputBegan(input, gameProcessed)
    if gameProcessed then return end

    -- Left Mouse Button Click
    if input.UserInputType == Enum.UserInputType.MouseButton1 then
        local mouse = player:GetMouse()
        local target = mouse.Target

        -- If the clicked target has a humanoid, toggle selection
        if target and target.Parent and hasHumanoid(target.Parent) then
            onModelClicked(target.Parent)
            updateVisuals()
        end
    end

    -- Example: Unlock current target with the 'U' key
    if input.KeyCode == Enum.KeyCode.U then
        if TRACKED_TARGET then
            TRACKED_TARGET = nil
            updateVisuals()
        end
    end
end

-- Connect Input Handler
UserInputService.InputBegan:Connect(onInputBegan)

-- Ensure the script continues working when the character respawns
player.CharacterAdded:Connect(function(newCharacter)
    character = newCharacter
    humanoidRootPart = newCharacter:WaitForChild("HumanoidRootPart")
    clearAllIndicators()
    TRACKED_TARGET = nil
end)

-- RunService to update the face tracking smoothly using Heartbeat
RunService.Heartbeat:Connect(function(deltaTime)
    trackTarget(deltaTime)

    -- Update the position of the target visual if exists
    if TRACKED_TARGET and targetVisuals[TRACKED_TARGET] then
        local rootPart = TRACKED_TARGET:FindFirstChild("HumanoidRootPart")
        if rootPart then
            targetVisuals[TRACKED_TARGET].Position = Vector3.new(rootPart.Position.X, rootPart.Position.Y - 1, rootPart.Position.Z)
        else
            -- If the target no longer has a HumanoidRootPart, clear the target
            TRACKED_TARGET = nil
            updateVisuals()
        end
    end
end)

-- Optional: Handle when a player leaves to clean up
Players.PlayerRemoving:Connect(function(leavingPlayer)
    if leavingPlayer == TRACKED_TARGET then
        TRACKED_TARGET = nil
        updateVisuals()
    end
end)