CCCPaste

5a10284ecd5d5

-- Integrated aimbot + persistent ESP + original UI
-- Intended for use inside your own game (not as an external exploit).

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local userInputService = game:GetService("UserInputService")
local runService = game:GetService("RunService")
local players = game:GetService("Players")
local workspace = game:GetService("Workspace")

-- Settings
local aimbotEnabled = false
local showFOV = true
local showESP = true            -- NEW: toggle persistent ESP
local FOVCircle = 120
local aimSmoothness = 0.18      -- 0 = instant snap, 1 = no movement (tune to taste)
local aimAtNeck = true          -- aim for neck/upper area between Head and UpperTorso

-- UI (kept from original, minor additions)
local screenGui = Instance.new("ScreenGui")
screenGui.Parent = game:GetService("CoreGui")
screenGui.Name = "AimbotMenu"
screenGui.ResetOnSpawn = false

local mainFrame = Instance.new("Frame")
mainFrame.Size = UDim2.new(0, 280, 0, 260) -- increased height to add ESP toggle
mainFrame.Position = UDim2.new(0, 10, 0, 10)
mainFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 35)
mainFrame.BorderSizePixel = 0
mainFrame.Active = true
mainFrame.Draggable = true
mainFrame.Parent = screenGui

local frameCorner = Instance.new("UICorner")
frameCorner.CornerRadius = UDim.new(0, 8)
frameCorner.Parent = mainFrame

local title = Instance.new("TextLabel")
title.Size = UDim2.new(1, 0, 0, 30)
title.Position = UDim2.new(0,0,0,0)
title.BackgroundColor3 = Color3.fromRGB(40, 40, 45)
title.TextColor3 = Color3.fromRGB(255, 100, 100)
title.Font = Enum.Font.GothamBold
title.TextSize = 16
title.Text = "HEADSHOT AIMBOT"
title.Parent = mainFrame

local aimbotToggle = Instance.new("TextButton")
aimbotToggle.Size = UDim2.new(0.8, 0, 0, 35)
aimbotToggle.Position = UDim2.new(0.1, 0, 0.15, 0)
aimbotToggle.BackgroundColor3 = Color3.fromRGB(55, 55, 60)
aimbotToggle.TextColor3 = Color3.fromRGB(255, 255, 255)
aimbotToggle.Font = Enum.Font.Gotham
aimbotToggle.TextSize = 14
aimbotToggle.Text = "Aimbot: OFF (R-Ctrl)"
aimbotToggle.Parent = mainFrame

local buttonCorner = Instance.new("UICorner")
buttonCorner.CornerRadius = UDim.new(0, 6)
buttonCorner.Parent = aimbotToggle

local fovToggle = Instance.new("TextButton")
fovToggle.Size = UDim2.new(0.8, 0, 0, 30)
fovToggle.Position = UDim2.new(0.1, 0, 0.35, 0)
fovToggle.BackgroundColor3 = Color3.fromRGB(55, 55, 60)
fovToggle.TextColor3 = Color3.fromRGB(255, 255, 255)
fovToggle.Font = Enum.Font.Gotham
fovToggle.TextSize = 12
fovToggle.Text = "Show FOV: ON"
fovToggle.Parent = mainFrame

local fovCorner = Instance.new("UICorner")
fovCorner.CornerRadius = UDim.new(0, 6)
fovCorner.Parent = fovToggle

local espToggle = Instance.new("TextButton") -- NEW: ESP toggle button
espToggle.Size = UDim2.new(0.8, 0, 0, 30)
espToggle.Position = UDim2.new(0.1, 0, 0.52, 0)
espToggle.BackgroundColor3 = Color3.fromRGB(55, 55, 60)
espToggle.TextColor3 = Color3.fromRGB(255, 255, 255)
espToggle.Font = Enum.Font.Gotham
espToggle.TextSize = 12
espToggle.Text = "ESP: ON"
espToggle.Parent = mainFrame

local fovSizeLabel = Instance.new("TextLabel")
fovSizeLabel.Size = UDim2.new(0.8, 0, 0, 20)
fovSizeLabel.Position = UDim2.new(0.1, 0, 0.7, 0)
fovSizeLabel.BackgroundTransparency = 1
fovSizeLabel.TextColor3 = Color3.fromRGB(200, 200, 200)
fovSizeLabel.Font = Enum.Font.Gotham
fovSizeLabel.TextSize = 11
fovSizeLabel.Text = "FOV Size: " .. FOVCircle
fovSizeLabel.TextXAlignment = Enum.TextXAlignment.Left
fovSizeLabel.Parent = mainFrame

local fovIncrease = Instance.new("TextButton")
fovIncrease.Size = UDim2.new(0.15, 0, 0, 20)
fovIncrease.Position = UDim2.new(0.7, 0, 0.7, 0)
fovIncrease.BackgroundColor3 = Color3.fromRGB(60, 60, 65)
fovIncrease.TextColor3 = Color3.fromRGB(255, 255, 255)
fovIncrease.Font = Enum.Font.GothamBold
fovIncrease.TextSize = 12
fovIncrease.Text = "+"
fovIncrease.Parent = mainFrame

local fovDecrease = Instance.new("TextButton")
fovDecrease.Size = UDim2.new(0.15, 0, 0, 20)
fovDecrease.Position = UDim2.new(0.85, 0, 0.7, 0)
fovDecrease.BackgroundColor3 = Color3.fromRGB(60, 60, 65)
fovDecrease.TextColor3 = Color3.fromRGB(255, 255, 255)
fovDecrease.Font = Enum.Font.GothamBold
fovDecrease.TextSize = 12
fovDecrease.Text = "-"
fovDecrease.Parent = mainFrame

local statusLabel = Instance.new("TextLabel")
statusLabel.Size = UDim2.new(1, 0, 0, 20)
statusLabel.Position = UDim2.new(0, 0, 0.88, 0)
statusLabel.BackgroundTransparency = 1
statusLabel.TextColor3 = Color3.fromRGB(200, 200, 200)
statusLabel.Font = Enum.Font.Gotham
statusLabel.TextSize = 11
statusLabel.Text = "Hold RMB to aim | Drag to move"
statusLabel.Parent = mainFrame

-- FOV circle (kept as the Frame approach)
local fovCircle = Instance.new("Frame")
fovCircle.Size = UDim2.new(0, FOVCircle * 2, 0, FOVCircle * 2)
fovCircle.BackgroundColor3 = Color3.fromRGB(255, 50, 50)
fovCircle.BackgroundTransparency = 0.92
fovCircle.BorderSizePixel = 0
fovCircle.Visible = showFOV
fovCircle.Parent = screenGui

local circleCorner = Instance.new("UICorner")
circleCorner.CornerRadius = UDim.new(1, 0)
circleCorner.Parent = fovCircle

local function updateFOVPosition()
    fovCircle.Position = UDim2.new(0, mouse.X - FOVCircle, 0, mouse.Y - FOVCircle)
end

local function updateFOVSize()
    fovCircle.Size = UDim2.new(0, FOVCircle * 2, 0, FOVCircle * 2)
    updateFOVPosition()
    fovSizeLabel.Text = "FOV Size: " .. FOVCircle
end

-- === Neck / Head position utility (keeps your original logic) ===
local function getNeckPosition(character)
    local head = character:FindFirstChild("Head")
    local upperTorso = character:FindFirstChild("UpperTorso")

    if head and upperTorso then
        local headPos = head.Position
        local torsoPos = upperTorso.Position + Vector3.new(0, 1.5, 0)
        local neckPosition = (headPos + torsoPos) / 2
        return neckPosition
    elseif head then
        return head.Position + Vector3.new(0, -0.3, 0)
    elseif upperTorso then
        return upperTorso.Position + Vector3.new(0, 1.5, 0)
    else
        local humanoidRoot = character:FindFirstChild("HumanoidRootPart")
        if humanoidRoot then
            return humanoidRoot.Position + Vector3.new(0, 1.8, 0)
        end
    end
    return nil
end

-- === Target selection inside FOV (keeps original idea but returns nearest) ===
local function getTargetInFOV()
    local camera = workspace.CurrentCamera
    local mousePos = Vector2.new(mouse.X, mouse.Y)
    local closestTarget = nil
    local closestDistance = FOVCircle

    for _, targetPlayer in pairs(players:GetPlayers()) do
        if targetPlayer ~= player and targetPlayer.Character then
            local character = targetPlayer.Character
            local humanoid = character:FindFirstChild("Humanoid")
            if humanoid and humanoid.Health > 0 then
                local neckPosition = getNeckPosition(character)
                if neckPosition then
                    local screenPoint = camera:WorldToViewportPoint(neckPosition)
                    if screenPoint.Z > 0 then
                        local distance = (Vector2.new(screenPoint.X, screenPoint.Y) - mousePos).Magnitude
                        if distance < closestDistance then
                            closestDistance = distance
                            closestTarget = targetPlayer
                        end
                    end
                end
            end
        end
    end
    return closestTarget
end

-- === Persistent ESP implementation (BillboardGui above HumanoidRootPart) ===
local espFolder = Instance.new("Folder")
espFolder.Name = "AimbotESP"
espFolder.Parent = screenGui

local function createESPForPlayer(plr)
    if espFolder:FindFirstChild(plr.Name) then return espFolder[plr.Name] end

    local bill = Instance.new("BillboardGui")
    bill.Name = plr.Name
    bill.Size = UDim2.new(0, 100, 0, 40)
    bill.Adornee = nil
    bill.AlwaysOnTop = true
    bill.StudsOffset = Vector3.new(0, 2.2, 0)
    bill.Parent = espFolder

    local bg = Instance.new("Frame", bill)
    bg.Size = UDim2.new(1, 0, 1, 0)
    bg.BackgroundTransparency = 0.6
    bg.BackgroundColor3 = Color3.fromRGB(0,0,0)
    bg.BorderSizePixel = 0

    local outline = Instance.new("Frame", bg)
    outline.Size = UDim2.new(1, 0, 1, 0)
    outline.BorderSizePixel = 1
    outline.BorderColor3 = Color3.fromRGB(0,255,0)
    outline.BackgroundTransparency = 1

    local nameLabel = Instance.new("TextLabel", bg)
    nameLabel.Size = UDim2.new(1, 0, 0.5, 0)
    nameLabel.Position = UDim2.new(0, 0, 0, 0)
    nameLabel.BackgroundTransparency = 1
    nameLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
    nameLabel.Font = Enum.Font.GothamBold
    nameLabel.TextSize = 12
    nameLabel.Text = plr.Name

    local hpLabel = Instance.new("TextLabel", bg)
    hpLabel.Size = UDim2.new(1, 0, 0.5, 0)
    hpLabel.Position = UDim2.new(0, 0, 0.5, 0)
    hpLabel.BackgroundTransparency = 1
    hpLabel.TextColor3 = Color3.fromRGB(200, 200, 200)
    hpLabel.Font = Enum.Font.Gotham
    hpLabel.TextSize = 10
    hpLabel.Text = ""
    hpLabel.Name = "HPLabel"

    return bill
end

local function updateESPForPlayer(plr)
    local bill = espFolder:FindFirstChild(plr.Name)
    if not bill then bill = createESPForPlayer(plr) end

    if not showESP then
        bill.Enabled = false
        return
    end

    if plr.Character and plr.Character.Parent and plr.Character:FindFirstChild("HumanoidRootPart") then
        bill.Adornee = plr.Character:FindFirstChild("HumanoidRootPart")
        bill.Enabled = true
        local humanoid = plr.Character:FindFirstChild("Humanoid")
        if humanoid then
            local hpLabel = bill:FindFirstChild("HPLabel", true)
            if hpLabel then
                hpLabel.Text = string.format("HP: %d", math.floor(humanoid.Health))
            end
        end
    else
        bill.Enabled = false
    end
end

-- === target dot (green dot between head/neck) ===
local targetDot = Instance.new("Frame")
targetDot.Size = UDim2.new(0, 8, 0, 8)
targetDot.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
targetDot.BorderSizePixel = 0
targetDot.Visible = false
targetDot.Parent = screenGui

local dotCorner = Instance.new("UICorner")
dotCorner.CornerRadius = UDim.new(1, 0)
dotCorner.Parent = targetDot

-- === Main aiming loop (camera-based, smooth) ===
runService.RenderStepped:Connect(function()
    -- FOV UI update
    if showFOV then
        updateFOVPosition()
    end

    -- Update ESP for all players
    for _, plr in ipairs(players:GetPlayers()) do
        if plr ~= player then
            pcall(function() updateESPForPlayer(plr) end)
        end
    end

    -- Determine target only if aimbot enabled and RMB pressed
    if not aimbotEnabled then
        target = nil
    else
        if userInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton2) then
            target = getTargetInFOV()
        else
            target = nil
        end
    end

    -- Show green dot at current target neck/head
    if target and target.Character then
        local neckPos = getNeckPosition(target.Character)
        if neckPos then
            local cam = workspace.CurrentCamera
            local screenPoint = cam:WorldToViewportPoint(neckPos)
            if screenPoint.Z > 0 then
                targetDot.Visible = true
                targetDot.Position = UDim2.new(0, screenPoint.X - 4, 0, screenPoint.Y - 4)
            else
                targetDot.Visible = false
            end
        else
            targetDot.Visible = false
        end
    else
        targetDot.Visible = false
    end

    -- Aim the camera smoothly toward the target's head/neck
    if aimbotEnabled and target and target.Character then
        local aimPosition = getNeckPosition(target.Character)
        if aimPosition then
            local cam = workspace.CurrentCamera
            local camPos = cam.CFrame.Position
            -- build target CFrame looking at aimPosition from current camera position
            local targetCFrame = CFrame.new(camPos, aimPosition)
            -- smooth lerp between current camera CFrame and targetCFrame
            local newCFrame = cam.CFrame:Lerp(targetCFrame, math.clamp(1 - aimSmoothness, 0, 1))
            -- set camera CFrame (this will rotate the camera to point toward the target smoothly)
            workspace.CurrentCamera.CFrame = newCFrame
        end
    end
end)

-- === Button handlers (UI) ===
aimbotToggle.MouseButton1Click:Connect(function()
    aimbotEnabled = not aimbotEnabled
    aimbotToggle.Text = "Aimbot: " .. (aimbotEnabled and "ON (R-Ctrl)" or "OFF (R-Ctrl)")
    aimbotToggle.BackgroundColor3 = aimbotEnabled and Color3.fromRGB(80, 50, 50) or Color3.fromRGB(55, 55, 60)
end)

fovToggle.MouseButton1Click:Connect(function()
    showFOV = not showFOV
    fovCircle.Visible = showFOV
    fovToggle.Text = "Show FOV: " .. (showFOV and "ON" or "OFF")
end)

espToggle.MouseButton1Click:Connect(function()
    showESP = not showESP
    espToggle.Text = "ESP: " .. (showESP and "ON" or "OFF")
end)

fovIncrease.MouseButton1Click:Connect(function()
    FOVCircle = math.min(FOVCircle + 10, 400)
    updateFOVSize()
end)

fovDecrease.MouseButton1Click:Connect(function()
    FOVCircle = math.max(FOVCircle - 10, 30)
    updateFOVSize()
end)

-- === Hotkeys ===
userInputService.InputBegan:Connect(function(input, gameProcessed)
    if gameProcessed then return end
    if input.KeyCode == Enum.KeyCode.RightControl then
        aimbotEnabled = not aimbotEnabled
        aimbotToggle.Text = "Aimbot: " .. (aimbotEnabled and "ON (R-Ctrl)" or "OFF (R-Ctrl)")
        aimbotToggle.BackgroundColor3 = aimbotEnabled and Color3.fromRGB(80, 50, 50) or Color3.fromRGB(55, 55, 60)
    elseif input.KeyCode == Enum.KeyCode.F then
        showFOV = not showFOV
        fovCircle.Visible = showFOV
        fovToggle.Text = "Show FOV: " .. (showFOV and "ON" or "OFF")
    elseif input.KeyCode == Enum.KeyCode.G then
        showESP = not showESP
        espToggle.Text = "ESP: " .. (showESP and "ON" or "OFF")
    end
end)

-- initialize FOV size and print
updateFOVSize()
print("Neck/Head Aimbot (camera-aim) loaded!")
print("Green dot shows neck/head position")
print("Right Control - Toggle Aimbot | F - Toggle FOV | G - Toggle ESP")