Universal Script ESP AIMLOCK
Key RequiredUniversal

Universal Script ESP AIMLOCK

Universal Scripthanzo*hanzo* 958 views 213 executesUpdated Jan 8, 2026
5.0/ 5(3 votes)
30100% Positive
Lua Script•889 lines (33823 chars)
-- 🎯 AIMBOT ULTRA-PRECIso + ESP SEPARADO (VERSÃO DEFINITIVA)
-- Sistema otimizado para headshots + ESP profissional independente
-- ✅ ZERO "attempt to index nil" - Validações ultra-rigorosas implementadas

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local UIS = game:GetService("UserInputService")
local LocalPlayer = Players.LocalPlayer

-- ========================================================================
-- 🟦 [ SISTEMA 1: DADOS ] - ESTADO PURO DO JOGO
-- ========================================================================

local GameDataSystem = {}

function GameDataSystem.getPlayers()
    if not Players or not Players.GetPlayers then return {} end
    local success, players = pcall(function() return Players:GetPlayers() end)
    return success and players or {}
end

function GameDataSystem.getLocalPlayer()
    return LocalPlayer or nil
end

function GameDataSystem.getCamera()
    if not workspace or not workspace.CurrentCamera then return nil end
    return workspace.CurrentCamera
end

function GameDataSystem.playerExists(player)
    return player and player:IsDescendantOf(Players)
end

function GameDataSystem.getCharacter(player)
    if not GameDataSystem.playerExists(player) then return nil end
    return player.Character
end

function GameDataSystem.characterExists(character)
    return character and character:IsDescendantOf(workspace)
end

function GameDataSystem.getHumanoid(character)
    if not GameDataSystem.characterExists(character) then return nil end
    return character:FindFirstChild("Humanoid")
end

function GameDataSystem.getHead(character)
    if not GameDataSystem.characterExists(character) then return nil end
    return character:FindFirstChild("Head")
end

function GameDataSystem.getRootPart(character)
    if not GameDataSystem.characterExists(character) then return nil end
    return character:FindFirstChild("HumanoidRootPart")
end

function GameDataSystem.getTeam(player)
    if not GameDataSystem.playerExists(player) then return nil end
    return player.Team
end

function GameDataSystem.getPosition(part)
    if not part or not part:IsA("BasePart") or not part:IsDescendantOf(workspace) then
        return Vector3.zero
    end
    local success, pos = pcall(function() return part.Position end)
    return success and pos and typeof(pos) == "Vector3" and pos or Vector3.zero
end

function GameDataSystem.getVelocity(part)
    if not part or not part:IsA("BasePart") or not part:IsDescendantOf(workspace) then
        return Vector3.zero
    end
    local success, vel = pcall(function() return part.AssemblyLinearVelocity end)
    return success and vel and typeof(vel) == "Vector3" and vel or Vector3.zero
end

function GameDataSystem.isAlive(humanoid)
    if not humanoid or not humanoid:IsDescendantOf(workspace) then return false end
    local success, health = pcall(function() return humanoid.Health end)
    return success and type(health) == "number" and health > 0
end

function GameDataSystem.getViewportSize(camera)
    if not camera then return Vector2.zero end
    local success, size = pcall(function() return camera.ViewportSize end)
    return success and size or Vector2.zero
end

function GameDataSystem.getMouseLocation()
    if not UIS or not UIS.GetMouseLocation then return Vector2.zero end
    local success, pos = pcall(function() return UIS:GetMouseLocation() end)
    return success and pos or Vector2.zero
end

-- ========================================================================
-- [ CONFIGURAÇÕES ULTRA-PRECISAS ] - OTIMIZADAS PARA CABEÇA
-- ========================================================================
local Config = {
    AIM_ENABLED = true,
    FOV_SIZE = 70,         -- FOV MAIS RESTRITO PARA CABEÇA (antes: 80)
    SMOOTHNESS = 0.04,     -- SUAVIZAÇÃO ULTRA-RÁPIDA PARA GRUDAÇÃO FORTE (antes: 0.06)
    HEAD_PRIORITY = true,  -- SEMPRE PRIORIZAR CABEÇA
    PREDICTION_ENABLED = true, -- PREDIÇÃO DE MOVIMENTO
    PREDICTION_TIME = 0.08, -- PREDIÇÃO MAIS CURTA PARA CABEÇA (80ms)
    UI_VISIBLE = false,
    WINDOW_ACTIVE = true,
    HEAD_BONUS_STRENGTH = 1.8  -- BONUS EXTRA PARA CABEÇA (80% mais forte)
}

-- ========================================================================
-- [ CONFIGURAÇÕES ESP MELHORADO ]
-- ========================================================================
getgenv().ESP_Settings = {
    Enabled = true,              -- Estado inicial
    ToggleKey = Enum.KeyCode.RightShift,

    DistanciaLimite = 300,       -- Distância máxima

    TeamCheck = true,            -- Verificar aliados
    TeamColor = Color3.fromRGB(0, 255, 0),      -- Verde
    EnemyColor = Color3.fromRGB(255, 0, 0),     -- Vermelho

    TextSize = 13,
    BoxThickness = 1,

    -- Configuração do Botão
    ButtonConfig = {
        Size = Vector2.new(120, 30),
        TextColor = Color3.new(1, 1, 1),
        EnabledColor = Color3.fromRGB(0, 150, 0),
        DisabledColor = Color3.fromRGB(150, 0, 0),
        TextFont = 2,
        TextSize = 15
    }
}

-- ========================================================================
-- [ CONTROLE DE FOCO ULTRA-SEGURO ]
-- ========================================================================
local WindowFocus = {
    janelaEmFoco = true,
    aimAtivo = false,
    alvoAtual = nil
}

function WindowFocus.inicializar()
    UIS.WindowFocused:Connect(function()
        WindowFocus.janelaEmFoco = true
        print("🖥️ ROBLOX EM FOCO - AIMLIBERADO")
    end)

    UIS.WindowFocusReleased:Connect(function()
        WindowFocus.janelaEmFoco = false
        WindowFocus.aimAtivo = false
        WindowFocus.alvoAtual = nil
        print("🚨 ROBLOX PERDEU FOCO - AIMDESABILITADO")
    end)

    WindowFocus.janelaEmFoco = true
end

-- ========================================================================
-- [ DETECÇÃO DE INIMIGOS ULTRA-RÁPIDA ]
-- ========================================================================
local EnemyDetector = {}

function EnemyDetector.ehInimigo(player)
    -- ✅ CORREÇÃO: Sistema de teams robusto (evita "No hook for GetTeam")
    if not GameDataSystem.playerExists(player) or player == LocalPlayer then return false end

    local playerTeam = GameDataSystem.getTeam(player)
    local localTeam = GameDataSystem.getTeam(GameDataSystem.getLocalPlayer())

    if playerTeam and localTeam then
        return playerTeam ~= localTeam
    end

    -- Método 2: Verificar atributos customizados
    local success1, playerAttrs = pcall(function() return player:GetAttributes() end)
    local success2, localAttrs = pcall(function() return LocalPlayer:GetAttributes() end)

    if success1 and success2 and playerAttrs and localAttrs then
        for attrName, attrValue in pairs(playerAttrs) do
            if type(attrName) == "string" and (attrName:lower():find("team") or attrName:lower():find("faction")) then
                local localAttrValue = localAttrs[attrName]
                if localAttrValue and attrValue ~= localAttrValue then
                    return true -- ✅ Times diferentes
                end
            end
        end
    end

    return true -- FFA MODE
end

function EnemyDetector.ehValido(player)
    -- ✅ CORREÇÃO: Validação ultra-rigorosa
    if not GameDataSystem.playerExists(player) then return false end

    local character = GameDataSystem.getCharacter(player)
    if not character or not GameDataSystem.characterExists(character) then return false end

    local humanoid = GameDataSystem.getHumanoid(character)
    return GameDataSystem.isAlive(humanoid)
end

-- ========================================================================
-- [ SELEÇÃO DE CABEÇA ULTRA-PRIORITÁRIA ] - MELHORADO PARA HEADSHOTS
-- ========================================================================
local BodyPartSelector = {}

-- 🔥 FUNÇÃO ESPECIAL: SEMPRE PEGA A CABEÇA PRIMEIRO
function BodyPartSelector.getHead(character)
    -- ✅ CORREÇÃO: Validação antes de qualquer acesso
    if not GameDataSystem.characterExists(character) then return nil end

    -- SEMPRE TENTA CABEÇA PRIMEIRO - MÚLTIPLAS VERIFICAÇÕES
    local head = character:FindFirstChild("Head")
    if head and head:IsA("BasePart") and head:IsDescendantOf(character) then
        return head
    end

    -- FALLBACK PARA DIFERENTES NOMES DE CABEÇA
    local headNames = {"Head", "head", "HEAD"}
    for _, name in ipairs(headNames) do
        if type(name) == "string" then
            local found = character:FindFirstChild(name)
            if found and found:IsA("BasePart") and found:IsDescendantOf(character) then
                return found
            end
        end
    end

    return nil
end

-- 🔥 PREDIÇÃO DE MOVIMENTO PARA PRECISÃO MÁXIMA
function BodyPartSelector.predictPosition(bodyPart, predictionTime)
    -- ✅ CORREÇÃO: Validação ultra-rigorosa antes de cálculos
    if not bodyPart or not bodyPart:IsA("BasePart") or not bodyPart:IsDescendantOf(workspace) then
        return GameDataSystem.getPosition(bodyPart)
    end

    if not Config.PREDICTION_ENABLED or type(predictionTime) ~= "number" or predictionTime <= 0 then
        return GameDataSystem.getPosition(bodyPart)
    end

    -- CALCULAR VELOCIDADE PARA PREDIÇÃO
    local position = GameDataSystem.getPosition(bodyPart)
    local velocity = GameDataSystem.getVelocity(bodyPart)

    -- ✅ CORREÇÃO: Verificação se valores são válidos antes da conta
    if position ~= Vector3.zero and velocity ~= Vector3.zero then
        return position + (velocity * predictionTime)
    end

    return position
end

-- 🔥 LÓGICA PRINCIPAL: CABEÇA SEMPRE PRIORITÁRIA
function BodyPartSelector.encontrarMelhorParte(character)
    -- ✅ CORREÇÃO: Validação antes de qualquer acesso
    if not GameDataSystem.characterExists(character) then return nil end

    -- 🔥 CABEÇA SEMPRE É PRIORIDADE MÁXIMA
    if Config.HEAD_PRIORITY then
        local head = BodyPartSelector.getHead(character)
        if head then
            return head -- 🔥 SEMPRE RETORNA CABEÇA PARA HEADSHOTS
        end
    end

    -- FALLBACK APENAS SE CABEÇA NÃO EXISTIR
    local fallbacks = {
        character:FindFirstChild("UpperTorso"),
        character:FindFirstChild("HumanoidRootPart"),
        character:FindFirstChild("Torso")
    }

    for _, part in ipairs(fallbacks) do
        if part and part:IsA("BasePart") and part:IsDescendantOf(character) then
            return part
        end
    end

    return nil
end

-- ========================================================================
-- [ FOV ULTRA-PRECISO ] - RESTRITO PARA CABEÇA
-- ========================================================================
local FOVSystem = {
    circulo = nil
}

function FOVSystem.criarCirculo()
    if FOVSystem.circulo then FOVSystem.circulo:Remove() end

    FOVSystem.circulo = Drawing.new("Circle")
    FOVSystem.circulo.Thickness = 2
    FOVSystem.circulo.NumSides = 32
    FOVSystem.circulo.Radius = Config.FOV_SIZE
    FOVSystem.circulo.Filled = false
    FOVSystem.circulo.Color = Color3.fromRGB(255, 255, 255)
    FOVSystem.circulo.Transparency = 0.7
    FOVSystem.circulo.Visible = false
end

function FOVSystem.calcular(posicaoMundo, camera)
    -- ✅ CORREÇÃO: Validação ultra-rigorosa
    if not posicaoMundo or typeof(posicaoMundo) ~= "Vector3" or not camera then return false end

    local centroTela = GameDataSystem.getViewportSize(camera)
    if centroTela == Vector2.zero then return false end
    centroTela = centroTela / 2

    local success, screenPos, visible = pcall(function()
        return camera:WorldToViewportPoint(posicaoMundo)
    end)

    if not success or not visible or not screenPos then return false end

    local distancia = (Vector2.new(screenPos.X, screenPos.Y) - centroTela).Magnitude
    return distancia <= Config.FOV_SIZE
end

function FOVSystem.atualizar()
    if not FOVSystem.circulo then return end

    local camera = GameDataSystem.getCamera()
    if not camera then return end

    local centro = GameDataSystem.getViewportSize(camera)
    if centro == Vector2.zero then return end
    centro = centro / 2

    FOVSystem.circulo.Position = centro
    FOVSystem.circulo.Radius = Config.FOV_SIZE
    FOVSystem.circulo.Visible = WindowFocus.aimAtivo and WindowFocus.janelaEmFoco
end

-- ========================================================================
-- [ SELETOR DE ALVO ULTRA-RÁPIDO ] - FOCADO EM CABEÇA
-- ========================================================================
local TargetSelector = {}

function TargetSelector.encontrarMelhor(camera)
    -- ✅ CORREÇÃO: Validação ultra-rigorosa antes de qualquer loop
    if not camera then return nil end

    local melhorAlvo = nil
    local menorDistancia = Config.FOV_SIZE
    local centroTela = GameDataSystem.getViewportSize(camera)
    if centroTela == Vector2.zero then return nil end
    centroTela = centroTela / 2

    for _, player in ipairs(GameDataSystem.getPlayers()) do
        -- ✅ VALIDAÇÃO: Player existe e é válido
        if not EnemyDetector.ehInimigo(player) or not EnemyDetector.ehValido(player) then
            continue
        end

        -- 🔥 VERIFICAÇÃO ESPECIAL: CABEÇA DEVE EXISTIR
        local character = GameDataSystem.getCharacter(player)
        if not character then continue end

        local head = BodyPartSelector.getHead(character)
        if not head then continue end

        -- 🔥 PREDIÇÃO PARA CABEÇA
        local targetPosition = BodyPartSelector.predictPosition(head, Config.PREDICTION_TIME)
        if targetPosition == Vector3.zero then continue end

        -- VERIFICAÇÃO FOV COM PREDIÇÃO
        if not FOVSystem.calcular(targetPosition, camera) then
            continue
        end

        -- DISTÂNCIA DA CABEÇA PREDITA
        local success, screenPos, visible = pcall(function()
            return camera:WorldToViewportPoint(targetPosition)
        end)

        if not success or not visible or not screenPos then continue end

        local distancia = (Vector2.new(screenPos.X, screenPos.Y) - centroTela).Magnitude

        if distancia < menorDistancia then
            menorDistancia = distancia
            melhorAlvo = player
        end
    end

    return melhorAlvo
end

-- ========================================================================
-- [ AIMLOCK ULTRA-PRECIso ] - OTIMIZADO PARA CABEÇA
-- ========================================================================
local AimController = {
    suavizacao = Config.SMOOTHNESS
}

function AimController.aplicar(alvoAtual, camera)
    -- 🔥 VERIFICAÇÕES AVANÇADAS PARA GRUDAÇÃO MÁXIMA
    if not WindowFocus.janelaEmFoco or not WindowFocus.aimAtivo then
        return
    end

    -- VERIFICAÇÃO RIGOROSA DO ALVO
    if not alvoAtual or not alvoAtual:IsDescendantOf(Players) then
        WindowFocus.alvoAtual = nil
        return
    end

    if not EnemyDetector.ehValido(alvoAtual) then
        WindowFocus.alvoAtual = nil
        return
    end

    local character = alvoAtual.Character
    if not character or not character:IsDescendantOf(workspace) then
        WindowFocus.alvoAtual = nil
        return
    end

    -- 🔥 SISTEMA AVANÇADO DE DETECÇÃO DE CABEÇA
    local head = BodyPartSelector.getHead(character)
    if not head or not head:IsDescendantOf(character) then
        -- FALLBACK: tentar encontrar cabeça novamente
        head = character:FindFirstChild("Head") or character:FindFirstChild("head")
        if not head then
            WindowFocus.alvoAtual = nil
            return
        end
    end

    -- 🔥 PREDIÇÃO AVANÇADA COM MÚLTIPLAS VERIFICAÇÕES
    local targetPosition = BodyPartSelector.predictPosition(head, Config.PREDICTION_TIME)

    -- VERIFICAÇÃO FOV ULTRA-ESTRITA COM MÚLTIPLOS CHECKS
    if not FOVSystem.calcular(targetPosition, camera) then
        -- TENTATIVA SECUNDÁRIA: verificar posição atual da cabeça
        local currentPos = GameDataSystem.getPosition(head)
        if currentPos == Vector3.zero or not FOVSystem.calcular(currentPos, camera) then
            WindowFocus.alvoAtual = nil
            return
        end
        targetPosition = currentPos
    end

    -- POSIÇÃO DA CABEÇA NA TELA COM VALIDAÇÃO
    local success, screenPos, visible = pcall(function()
        return camera:WorldToViewportPoint(targetPosition)
    end)

    if not success or not visible or not screenPos then
        WindowFocus.alvoAtual = nil
        return
    end

    -- VERIFICAÇÃO DE DISTÂNCIA DA TELA (não pode estar muito longe)
    local screenCenter = GameDataSystem.getViewportSize(camera)
    if screenCenter == Vector2.zero then return end
    screenCenter = screenCenter / 2

    local screenDistance = (Vector2.new(screenPos.X, screenPos.Y) - screenCenter).Magnitude
    if screenDistance > Config.FOV_SIZE * 1.5 then  -- 50% de tolerância
        WindowFocus.alvoAtual = nil
        return
    end

    -- POSIÇÃO ATUAL DO MOUSE COM VALIDAÇÃO
    local mousePos = GameDataSystem.getMouseLocation()
    if mousePos == Vector2.zero then return end

    -- DIFERENÇA ULTRA-PRECISA COM VALIDAÇÃO
    local delta = Vector2.new(screenPos.X, screenPos.Y) - mousePos

    -- 🔥 SISTEMA ULTRA-FORTE DE GRUDAÇÃO NA CABEÇA
    -- THRESHOLD ULTRA-BAIXO PARA CABEÇA: muito mais sensível
    local distanceFactor = screenDistance / Config.FOV_SIZE
    local adaptiveThreshold = math.max(0.03, 1.2 - (distanceFactor * 0.8)) -- Threshold muito menor para cabeça

    if math.abs(delta.X) > adaptiveThreshold or math.abs(delta.Y) > adaptiveThreshold then
        -- 🔥 SUAVIZAÇÃO ULTRA-FORTE PARA CABEÇA
        local adaptiveSmoothness = Config.SMOOTHNESS * (1 + distanceFactor * 0.8) -- Muito mais rápida quando longe

        -- BONUS ULTRA-FORTE PARA CABEÇA: 80% mais forte na cabeça
        local headBonus = Config.HEAD_BONUS_STRENGTH -- 1.8 = 80% mais forte
        adaptiveSmoothness = adaptiveSmoothness * headBonus

        -- LIMITES ULTRA-EXPANDIDOS PARA GRUDAÇÃO MÁXIMA NA CABEÇA
        local maxMove = math.clamp(50 + (distanceFactor * 35), 30, 85) -- Limites muito maiores para cabeça
        local moveX = math.clamp(delta.X * adaptiveSmoothness, -maxMove, maxMove)
        local moveY = math.clamp(delta.Y * adaptiveSmoothness, -maxMove, maxMove)

        -- VALIDAÇÃO FINAL ANTES DO MOVIMENTO
        if moveX == moveX and moveY == moveY and -- Verificar se não é NaN
           math.abs(moveX) > 0.1 and math.abs(moveY) > 0.1 then -- Movimento mínimo

            -- MOVIMENTO ULTRA-SEGURO COM LOG DETALHADO
            local moveSuccess = pcall(function()
                mousemoverel(moveX, moveY)
            end)

            if moveSuccess then
                -- VISUAL FEEDBACK AVANÇADO
                if FOVSystem.circulo then
                    -- COR BASEADA NA DISTÂNCIA: vermelho = longe, verde = perto
                    local colorIntensity = 1 - math.min(distanceFactor, 1)
                    FOVSystem.circulo.Color = Color3.new(1, colorIntensity, 0) -- Amarelo para longe, vermelho para perto
                end
            else
                print("❌ Falha ao mover mouse para", alvoAtual.Name)
            end
        end
    else
        -- VISUAL FEEDBACK QUANDO PRECISO (VERDE)
        if FOVSystem.circulo then
            FOVSystem.circulo.Color = Color3.fromRGB(0, 255, 0)
        end
    end
end

-- ========================================================================
-- [ UI AIMLOCK + CONTROLE ESP ] - INTERFACES SEPARADAS COM DESIGN BONITO
-- ========================================================================
local UIController = {
    painel = nil,
    gui = nil,
    espToggle = nil
}

function UIController.criar()
    local playerGui = LocalPlayer:WaitForChild("PlayerGui", 10)
    if not playerGui then return end

    UIController.gui = Instance.new("ScreenGui")
    UIController.gui.Name = "AimbotUI"
    UIController.gui.ResetOnSpawn = false
    UIController.gui.Enabled = true
    UIController.gui.Parent = playerGui

    -- PAINEL AIMLOCK ULTRA-BONITO COM GRADIENTE
    UIController.painel = Instance.new("Frame")
    UIController.painel.Size = UDim2.new(0, 320, 0, 450)
    UIController.painel.Position = UDim2.new(0.75, -160, 0.05, 0)
    UIController.painel.AnchorPoint = Vector2.new(0.5, 0.5)
    UIController.painel.BackgroundColor3 = Color3.fromRGB(15, 15, 25)
    UIController.painel.BackgroundTransparency = 0.05
    UIController.painel.BorderSizePixel = 0
    UIController.painel.Parent = UIController.gui
    UIController.painel.Active = true
    UIController.painel.Draggable = true  -- Arrastar de qualquer lugar
    UIController.painel.Visible = false

    -- GRADIENTE BONITO
    local gradient = Instance.new("UIGradient")
    gradient.Color = ColorSequence.new{
        ColorSequenceKeypoint.new(0, Color3.fromRGB(25, 25, 45)),
        ColorSequenceKeypoint.new(0.5, Color3.fromRGB(20, 20, 35)),
        ColorSequenceKeypoint.new(1, Color3.fromRGB(15, 15, 25))
    }
    gradient.Parent = UIController.painel

    -- BORDAS SUPER REDONDAS
    local corner = Instance.new("UICorner")
    corner.CornerRadius = UDim.new(0, 25)
    corner.Parent = UIController.painel

    -- STROKE BONITO
    local stroke = Instance.new("UIStroke")
    stroke.Color = Color3.fromRGB(100, 100, 200)
    stroke.Thickness = 2.5
    stroke.Transparency = 0.2
    stroke.Parent = UIController.painel

    -- SOMBRA INTERNA BONITA
    local shadow = Instance.new("Frame")
    shadow.Size = UDim2.new(1, 6, 1, 6)
    shadow.Position = UDim2.new(0, -3, 0, -3)
    shadow.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
    shadow.BackgroundTransparency = 0.8
    shadow.BorderSizePixel = 0
    shadow.ZIndex = -1
    local shadowCorner = Instance.new("UICorner")
    shadowCorner.CornerRadius = UDim.new(0, 28)
    shadowCorner.Parent = shadow
    shadow.Parent = UIController.painel

    -- TITLE ULTRA-BONITO
    local title = Instance.new("TextLabel")
    title.Size = UDim2.new(1, 0, 0, 45)
    title.BackgroundTransparency = 1
    title.Text = "🎯 AIMBOT CABEÇA ULTRA-FORTE"
    title.Font = Enum.Font.GothamBold
    title.TextSize = 16
    title.TextColor3 = Color3.fromRGB(255, 100, 100)
    title.Parent = UIController.painel

    -- AIM TOGGLE ULTRA-BONITO
    local aimToggle = Instance.new("TextButton")
    aimToggle.Size = UDim2.new(0.8, 0, 0, 35)
    aimToggle.Position = UDim2.new(0.1, 0, 0.2, 0)
    aimToggle.BackgroundColor3 = WindowFocus.aimAtivo and Color3.fromRGB(0, 180, 0) or Color3.fromRGB(180, 0, 0)
    aimToggle.Text = "🎯 AIM: " .. (WindowFocus.aimAtivo and "ON" or "OFF")
    aimToggle.Font = Enum.Font.GothamBold
    aimToggle.TextSize = 14
    aimToggle.TextColor3 = Color3.fromRGB(255, 255, 255)
    aimToggle.BorderSizePixel = 0
    aimToggle.Parent = UIController.painel

    -- CORNER PARA O BOTÃO AIM
    local aimCorner = Instance.new("UICorner")
    aimCorner.CornerRadius = UDim.new(0, 10)
    aimCorner.Parent = aimToggle

    -- ESP TOGGLE ULTRA-BONITO (NOVO!)
    local espToggle = Instance.new("TextButton")
    espToggle.Size = UDim2.new(0.8, 0, 0, 35)
    espToggle.Position = UDim2.new(0.1, 0, 0.32, 0)
    espToggle.BackgroundColor3 = getgenv().ESP_Settings.Enabled and Color3.fromRGB(0, 150, 0) or Color3.fromRGB(150, 0, 0)
    espToggle.Text = "👁️ ESP: " .. (getgenv().ESP_Settings.Enabled and "ON" or "OFF")
    espToggle.Font = Enum.Font.GothamBold
    espToggle.TextSize = 14
    espToggle.TextColor3 = Color3.fromRGB(255, 255, 255)
    espToggle.BorderSizePixel = 0
    espToggle.Parent = UIController.painel

    -- CORNER PARA O BOTÃO ESP
    local espCorner = Instance.new("UICorner")
    espCorner.CornerRadius = UDim.new(0, 10)
    espCorner.Parent = espToggle

    -- FOV SLIDER PARA CABEÇA (FOCO EM PRECISÃO)
    local fovLabel = Instance.new("TextLabel")
    fovLabel.Size = UDim2.new(0.8, 0, 0, 20)
    fovLabel.Position = UDim2.new(0.1, 0, 0.48, 0)
    fovLabel.BackgroundTransparency = 1
    fovLabel.Text = "🎯 FOV CABEÇA: " .. Config.FOV_SIZE
    fovLabel.Font = Enum.Font.GothamMedium
    fovLabel.TextSize = 12
    fovLabel.TextColor3 = Color3.fromRGB(255, 150, 150)
    fovLabel.Parent = UIController.painel

    -- SLIDER BACKGROUND ULTRA-BONITO
    local sliderBg = Instance.new("Frame")
    sliderBg.Size = UDim2.new(0.8, 0, 0, 15)
    sliderBg.Position = UDim2.new(0.1, 0, 0.55, 0)
    sliderBg.BackgroundColor3 = Color3.fromRGB(60, 30, 30)
    sliderBg.BorderSizePixel = 2
    sliderBg.BorderColor3 = Color3.fromRGB(150, 100, 100)
    sliderBg.Parent = UIController.painel

    -- CORNER PARA SLIDER
    local sliderCorner = Instance.new("UICorner")
    sliderCorner.CornerRadius = UDim.new(0, 7)
    sliderCorner.Parent = sliderBg

    -- SLIDER FILL ULTRA-BONITO
    local sliderFill = Instance.new("Frame")
    sliderFill.Size = UDim2.fromScale((Config.FOV_SIZE - 30) / 120, 1)
    sliderFill.BackgroundColor3 = Color3.fromRGB(255, 100, 100)
    sliderFill.BorderSizePixel = 0
    sliderFill.Parent = sliderBg

    -- CORNER PARA FILL
    local fillCorner = Instance.new("UICorner")
    fillCorner.CornerRadius = UDim.new(0, 7)
    fillCorner.Parent = sliderFill

    -- SLIDER HANDLE ULTRA-BONITO
    local sliderHandle = Instance.new("Frame")
    sliderHandle.Size = UDim2.new(0, 20, 0, 20)
    sliderHandle.Position = UDim2.fromScale((Config.FOV_SIZE - 30) / 120 - 0.08, -0.25)
    sliderHandle.BackgroundColor3 = Color3.fromRGB(255, 150, 150)
    sliderHandle.BorderSizePixel = 3
    sliderHandle.BorderColor3 = Color3.fromRGB(255, 255, 255)
    sliderHandle.Parent = sliderBg

    -- CORNER PARA HANDLE
    local handleCorner = Instance.new("UICorner")
    handleCorner.CornerRadius = UDim.new(0, 10)
    handleCorner.Parent = sliderHandle

    -- VARIÁVEIS DO SLIDER
    local minFOV = 30
    local maxFOV = 150
    local draggingSlider = false

    -- FUNÇÃO PARA ATUALIZAR SLIDER
    local function updateSlider()
        local percent = (Config.FOV_SIZE - minFOV) / (maxFOV - minFOV)
        sliderFill.Size = UDim2.fromScale(math.clamp(percent, 0, 1), 1)
        sliderHandle.Position = UDim2.fromScale(math.clamp(percent - 0.08, -0.08, 0.92), -0.25)
        fovLabel.Text = "🎯 FOV CABEÇA: " .. Config.FOV_SIZE
    end

    -- EVENTOS DO SLIDER
    sliderBg.InputBegan:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 then
            draggingSlider = true
            local percent = math.clamp((input.Position.X - sliderBg.AbsolutePosition.X) / sliderBg.AbsoluteSize.X, 0, 1)
            Config.FOV_SIZE = math.floor(minFOV + (maxFOV - minFOV) * percent)
            updateSlider()
        end
    end)

    sliderBg.InputEnded:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 then
            draggingSlider = false
        end
    end)

    sliderHandle.InputBegan:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 then
            draggingSlider = true
        end
    end)

    sliderHandle.InputEnded:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 then
            draggingSlider = false
        end
    end)

    -- ATUALIZAR SLIDER QUANDO MOUSE SE MOVE
    UIS.InputChanged:Connect(function(input)
        if draggingSlider and input.UserInputType == Enum.UserInputType.MouseMovement then
            local percent = math.clamp((input.Position.X - sliderBg.AbsolutePosition.X) / sliderBg.AbsoluteSize.X, 0, 1)
            Config.FOV_SIZE = math.floor(minFOV + (maxFOV - minFOV) * percent)
            updateSlider()
        end
    end)

    -- STATUS DO AIMBOT ULTRA-BONITO
    local statusText = Instance.new("TextLabel")
    statusText.Size = UDim2.new(0.9, 0, 0, 80)
    statusText.Position = UDim2.new(0.05, 0, 0.75, 0)
    statusText.BackgroundTransparency = 1
    statusText.Text = "🎯 AIMBOT CABEÇA ULTRA-FORTE\n🔥 PREDIÇÃO: " .. (Config.PREDICTION_ENABLED and "ON" or "OFF") .. "\n💪 FORÇA CABEÇA: " .. (Config.HEAD_BONUS_STRENGTH * 100) .. "%\n👁️ ESP: " .. (getgenv().ESP_Settings.Enabled and "ON" or "OFF")
    statusText.Font = Enum.Font.GothamMedium
    statusText.TextSize = 8
    statusText.TextColor3 = Color3.fromRGB(255, 150, 150)
    statusText.TextWrapped = true
    statusText.Parent = UIController.painel

    -- FUNCIONALIDADES DOS BOTÕES
    aimToggle.MouseButton1Click:Connect(function()
        if not WindowFocus.janelaEmFoco then
            print("🚫 NÃO É POSSÍVEL ATIVAR AIMLOCK FORA DO ROBLOX")
            return
        end

        WindowFocus.aimAtivo = not WindowFocus.aimAtivo
        aimToggle.BackgroundColor3 = WindowFocus.aimAtivo and Color3.fromRGB(0, 180, 0) or Color3.fromRGB(180, 0, 0)
        aimToggle.Text = "🎯 AIM: " .. (WindowFocus.aimAtivo and "ON" or "OFF")

        if not WindowFocus.aimAtivo then
            WindowFocus.alvoAtual = nil
        end

        -- Atualizar status
        statusText.Text = "🎯 AIMBOT CABEÇA ULTRA-FORTE\n🔥 PREDIÇÃO: " .. (Config.PREDICTION_ENABLED and "ON" or "OFF") .. "\n💪 FORÇA CABEÇA: " .. (Config.HEAD_BONUS_STRENGTH * 100) .. "%\n👁️ ESP: " .. (getgenv().ESP_Settings.Enabled and "ON" or "OFF")
    end)

    -- FUNCIONALIDADE ESP TOGGLE (NOVO!)
    espToggle.MouseButton1Click:Connect(function()
        getgenv().ESP_Settings.Enabled = not getgenv().ESP_Settings.Enabled
        espToggle.BackgroundColor3 = getgenv().ESP_Settings.Enabled and Color3.fromRGB(0, 150, 0) or Color3.fromRGB(150, 0, 0)
        espToggle.Text = "👁️ ESP: " .. (getgenv().ESP_Settings.Enabled and "ON" or "OFF")

        if getgenv().ESP_Settings.Enabled then
            print("👁️ ESP ATIVADO - PRESSIONE RIGHT SHIFT PARA TOGGLE")
        else
            print("👁️ ESP DESATIVADO")
        end

        -- Atualizar status
        statusText.Text = "🎯 AIMBOT CABEÇA ULTRA-FORTE\n🔥 PREDIÇÃO: " .. (Config.PREDICTION_ENABLED and "ON" or "OFF") .. "\n💪 FORÇA CABEÇA: " .. (Config.HEAD_BONUS_STRENGTH * 100) .. "%\n👁️ ESP: " .. (getgenv().ESP_Settings.Enabled and "ON" or "OFF")
    end)

    -- TOGGLE UI
    UIS.InputBegan:Connect(function(input, gameProcessed)
        if gameProcessed then return end
        if input.KeyCode == Enum.KeyCode.Insert then
            UIController.painel.Visible = not UIController.painel.Visible
            print("🎮 UI:", UIController.painel.Visible and "VISÍVEL" or "OCULTA", "(tecle INSERT)")
        end
    end)
end

-- ========================================================================
-- [ CARREGAR ESP MELHORADO ]
-- ========================================================================
local function loadESP()
    print("🎨 CARREGANDO ESP MELHORADO...")

    -- CARREGAR ESP VIA LOADSTRING
    local success, error = pcall(function()
        loadstring(game:HttpGet("https://raw.githubusercontent.com/ZiriloXXX/EspTLF/refs/heads/main/script.lua"))()
    end)

    if success then
        print("✅ ESP MELHORADO CARREGADO COM SUCESSO!")
        print("🔴 VERMELHO = INIMIGOS | 🟢 VERDE = ALIADOS")
        print("📦 BOX + NOME + DISTÂNCIA + HEALTH BAR")
        print("🎯 RIGHT SHIFT PARA TOGGLE DO ESP")
    else
        print("❌ ERRO AO CARREGAR ESP:", error)
        print("🎯 AIMBOT FUNCIONARÁ NORMALMENTE SEM ESP")
    end
end

-- ========================================================================
-- [ INICIALIZAÇÃO ULTRA-RÁPIDA ]
-- ========================================================================
print("🎯 INICIALIZANDO AIMBOT CABEÇA ULTRA-FORTE + ESP SEPARADO...")

-- INICIALIZAR COMPONENTES
WindowFocus.inicializar()
FOVSystem.criarCirculo()
UIController.criar()

-- CARREGAR ESP MELHORADO (SEPARADO)
loadESP()

print("✅ SISTEMA CABEÇA ULTRA-FORTE INICIALIZADO!")
print("🎯 AIMLOCK: GRUDAÇÃO ULTRA-FORTE NA CABEÇA")
print("⚡ FOV CABEÇA RESTRITO: " .. Config.FOV_SIZE)
print("🔥 SUAVIZAÇÃO ULTRA-RÁPIDA: " .. Config.SMOOTHNESS)
print("💪 BONUS CABEÇA: " .. (Config.HEAD_BONUS_STRENGTH * 100) .. "% MAIS FORTE")
print("🎨 ESP: CARREGADO SEPARADAMENTE (RIGHT SHIFT)")
print("🎮 INSERT PARA UI DO AIMBOT")
print("👁️ BOTÃO ESP NA INTERFACE PARA ATIVAR/DESATIVAR")

-- ========================================================================
-- [ LOOP PRINCIPAL ULTRA-OTIMIZADO ]
-- ========================================================================
RunService.RenderStepped:Connect(function()
    -- 🔥 VERIFICAÇÃO CRÍTICA DE FOCO - SEMPRE PRIMEIRO
    if not WindowFocus.janelaEmFoco then
        return
    end

    -- VALIDAR CÂMERA ULTRA-RÁPIDA
    local camera = GameDataSystem.getCamera()
    if not camera then return end

    local viewportCenter = GameDataSystem.getViewportSize(camera)
    if viewportCenter == Vector2.zero then return end
    viewportCenter = viewportCenter / 2

    -- 🔥 AIMLOCK LÓGICA ULTRA-PRECIOSA - CABEÇA SEMPRE
    if WindowFocus.aimAtivo then
        -- VALIDAR ALVO ATUAL CONSTANTEMENTE
        if WindowFocus.alvoAtual and not EnemyDetector.ehValido(WindowFocus.alvoAtual) then
            WindowFocus.alvoAtual = nil
        end

        -- PROCURAR MELHOR CABEÇA CONSTANTEMENTE
        if not WindowFocus.alvoAtual then
            WindowFocus.alvoAtual = TargetSelector.encontrarMelhor(camera)
        end

        -- APLICAR AIMLOCK NA CABEÇA
        if WindowFocus.alvoAtual then
            AimController.aplicar(WindowFocus.alvoAtual, camera)
        end
    end

    -- FOV VISUAL ULTRA-PRECIso
    FOVSystem.atualizar()
end)

print("🎯 AIMBOT CABEÇA ULTRA-FORTE OPERACIONAL!")
print("🔥 SEMPRE TRAVA NA CABEÇA COM FORÇA MÁXIMA")
print("⚡ PREDIÇÃO DE MOVIMENTO ATIVA (80ms)")
print("🎚️ SLIDER FOV CABEÇA FUNCIONAL (30-150)")
print("💪 BONUS CABEÇA: " .. (Config.HEAD_BONUS_STRENGTH * 100) .. "% MAIS FORTE")
print("🎨 ESP CARREGADO SEPARADAMENTE (RIGHT SHIFT)")
print("🚫 CURSOR SEGURO FORA DO ROBLOX")
print("🎮 ARRASTE O PAINEL INTEIRO PARA MOVER")
print("⚡ GRUDAÇÃO ULTRA-FORTE: threshold mínimo + movimento máximo para cabeça")

Features & Information

Universal AIMLOCK + ESP

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts