Загрузка данных


-- Kill Aura (ПКМ) — активация по клавише K
local Players=game:GetService("Players")
local RunService=game:GetService("RunService")
local UIS=game:GetService("UserInputService")
local Camera=workspace.CurrentCamera
local LP=Players.LocalPlayer

local enabled=false
local target=nil
local fireRate=0.1
local lastFire=0

-- Функция клика ПКМ (правая кнопка)
local function rightClick()
    if mouse2click then
        mouse2click()
    elseif syn and syn.mouse2click then
        syn.mouse2click()
    elseif getgenv and getgenv().mouse2click then
        getgenv().mouse2click()
    else
        local mouse=LP:GetMouse()
        if mouse and mouse.Button2Click then
            mouse.Button2Click()
        end
    end
end

-- Проверка видимости (не сквозь стены)
local function isVisible(head)
    local origin=Camera.CFrame.Position
    local dir=(head.Position-origin).Unit
    local ray=Ray.new(origin, dir*(head.Position-origin).Magnitude)
    local hit,pos=workspace:FindPartOnRayWithIgnoreList(ray, {LP.Character, Camera})
    if hit then
        local dHit=(pos-origin).Magnitude
        local dHead=(head.Position-origin).Magnitude
        if dHit<dHead-0.5 then return false end
    end
    return true
end

-- Поиск ближайшей цели (в поле зрения, не за стеной)
local function findTarget()
    local closestDist=math.huge
    local closestHead=nil
    local camDir=Camera.CFrame.LookVector
    for _,p in pairs(Players:GetPlayers()) do
        if p==LP then continue end
        local c=p.Character
        if not c then continue end
        local head=c:FindFirstChild("Head")
        if not head then continue end
        local toTarget=(head.Position-Camera.CFrame.Position).Unit
        if camDir:Dot(toTarget)<0.5 then continue end
        if not isVisible(head) then continue end
        local dist=(head.Position-Camera.CFrame.Position).Magnitude
        if dist<closestDist then
            closestDist=dist
            closestHead=head
        end
    end
    return closestHead
end

-- Наведение персонажа на голову цели
local function aimAt(head)
    local char=LP.Character
    if not char then return end
    local root=char:FindFirstChild("HumanoidRootPart")
    if not root then return end
    local hum=char:FindFirstChild("Humanoid")
    if hum then hum.AutoRotate=false end
    local dir=(head.Position-root.Position)*Vector3.new(1,0,1)
    if dir.Magnitude<0.5 then return end
    root.CFrame=CFrame.lookAt(root.Position, root.Position+dir)
end

-- Обработка клавиш
UIS.InputBegan:Connect(function(i, g)
    if g then return end
    if i.KeyCode==Enum.KeyCode.K then
        enabled=not enabled
        if enabled then print("Kill Aura ON") else print("Kill Aura OFF") end
    end
end)

-- Основной цикл
RunService.RenderStepped:Connect(function()
    if not enabled then return end
    local now=tick()
    if now-lastFire<fireRate then return end
    local head=findTarget()
    if head then
        aimAt(head)
        rightClick()
        lastFire=now
    end
end)

print("Press K to toggle Kill Aura (PCM)")