ESP and Aimbot
Key Required

ESP and Aimbot

Arsenalgytisbutnigytisbutni 6.6K views 19 executesUpdated Mar 26, 2025
Unrated
00
Lua Script•264 lines (10206 chars)
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")

local LocalPlayer = Players.LocalPlayer
local Camera = workspace.CurrentCamera
local Mouse = LocalPlayer:GetMouse()

-- Toggle variable for aim assist
local aimAssistEnabled = false
-- Variable to track current target
local currentTarget = nil

-- Configurable settings
local MAX_FOV = 45 -- Wide FOV for acquisition and stickiness
local PREDICTION_FACTOR = 0.05 -- Minimal prediction for slight smoothing

-- Function to create ESP box and tracer for a character
local function createESP(character)
    if character and character ~= LocalPlayer.Character then
        local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
        if not humanoidRootPart then return end

        if not humanoidRootPart:FindFirstChild("ESP_Box") then
            local box = Instance.new("BoxHandleAdornment")
            box.Name = "ESP_Box"
            box.Size = Vector3.new(5, 7, 5)
            box.Color3 = Color3.fromRGB(255, 0, 0)
            box.Transparency = 0.7
            box.AlwaysOnTop = true
            box.ZIndex = 10
            box.Adornee = humanoidRootPart
            box.Parent = humanoidRootPart
        end

        if not humanoidRootPart:FindFirstChild("ESP_Tracer") then
            local tracer = Instance.new("Beam")
            tracer.Name = "ESP_Tracer"
            tracer.Color = ColorSequence.new(Color3.fromRGB(255, 0, 0))
            tracer.Transparency = NumberSequence.new(0.5)
            tracer.Width0 = 1
            tracer.Width1 = 1
            tracer.Parent = humanoidRootPart
            
            local attachment0 = Instance.new("Attachment")
            attachment0.Name = "TracerStart"
            attachment0.Parent = LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("HumanoidRootPart") or humanoidRootPart
            
            local attachment1 = Instance.new("Attachment")
            attachment1.Name = "TracerEnd"
            attachment1.Parent = humanoidRootPart
            
            tracer.Attachment0 = attachment0
            tracer.Attachment1 = attachment1
        end
    end
end

-- Function to remove ESP elements from a character
local function removeESP(character)
    if character then
        local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
        if humanoidRootPart then
            local box = humanoidRootPart:FindFirstChild("ESP_Box")
            if box then box:Destroy() end
            
            local tracer = humanoidRootPart:FindFirstChild("ESP_Tracer")
            if tracer then 
                if tracer.Attachment0 then tracer.Attachment0:Destroy() end
                if tracer.Attachment1 then tracer.Attachment1:Destroy() end
                tracer:Destroy() 
            end
        end
    end
end

-- Function to update tracer starting point
local function updateTracers()
    local myRoot = LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
    if myRoot then
        for _, player in pairs(Players:GetPlayers()) do
            if player ~= LocalPlayer and player.Character then
                local theirRoot = player.Character:FindFirstChild("HumanoidRootPart")
                if theirRoot then
                    local tracer = theirRoot:FindFirstChild("ESP_Tracer")
                    if tracer and tracer.Attachment0 then
                        tracer.Attachment0.Parent = myRoot
                    end
                end
            end
        end
    end
end

-- Function to update ESP for all players
local function updateESP()
    for _, player in pairs(Players:GetPlayers()) do
        if player ~= LocalPlayer and player.Character then
            createESP(player.Character)
        end
    end
    updateTracers()
end

-- Function to get target with perfect stickiness and team check
local function getTargetInView()
    local cameraDirection = Camera.CFrame.LookVector
    local myRoot = LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
    if not myRoot then return nil end

    -- Get local player's team color
    local myTeamColor = LocalPlayer.TeamColor

    -- Stick to current target if valid
    if currentTarget and currentTarget.Character then
        local head = currentTarget.Character:FindFirstChild("Head")
        local humanoid = currentTarget.Character:FindFirstChild("Humanoid")
        if head and humanoid and humanoid.Health > 0 and currentTarget.TeamColor ~= myTeamColor then
            local vectorToPlayer = (head.Position - Camera.CFrame.Position).Unit
            local distance = (head.Position - myRoot.Position).Magnitude
            local angle = math.deg(math.acos(cameraDirection:Dot(vectorToPlayer)))
            
            if angle <= MAX_FOV then
                local ray = Ray.new(Camera.CFrame.Position, (head.Position - Camera.CFrame.Position).Unit * distance)
                local hit, _ = workspace:FindPartOnRayWithIgnoreList(ray, {LocalPlayer.Character})
                if hit and hit:IsDescendantOf(currentTarget.Character) then
                    local _, onScreen = Camera:WorldToViewportPoint(head.Position)
                    if onScreen then
                        return currentTarget
                    end
                end
            end
        end
        currentTarget = nil -- Clear if invalid
    end

    -- Find a new target
    local newTarget = nil
    for _, player in pairs(Players:GetPlayers()) do
        if player ~= LocalPlayer and player.Character then
            local head = player.Character:FindFirstChild("Head")
            local humanoid = player.Character:FindFirstChild("Humanoid")
            if head and humanoid and humanoid.Health > 0 and player.TeamColor ~= myTeamColor then
                local vectorToPlayer = (head.Position - Camera.CFrame.Position).Unit
                local distance = (head.Position - myRoot.Position).Magnitude
                local angle = math.deg(math.acos(cameraDirection:Dot(vectorToPlayer)))
                
                if angle <= MAX_FOV then
                    local ray = Ray.new(Camera.CFrame.Position, (head.Position - Camera.CFrame.Position).Unit * distance)
                    local hit, _ = workspace:FindPartOnRayWithIgnoreList(ray, {LocalPlayer.Character})
                    if hit and hit:IsDescendantOf(player.Character) then
                        local _, onScreen = Camera:WorldToViewportPoint(head.Position)
                        if onScreen then
                            newTarget = player
                            break
                        end
                    end
                end
            end
        end
    end

    -- Set new target without debounce for instant switch
    if newTarget then
        currentTarget = newTarget
    end
    return currentTarget
end

-- Aim assist with perfect, instant tracking
local aimConnection
local function startAimAssist()
    if aimConnection then aimConnection:Disconnect() end
    aimConnection = RunService.RenderStepped:Connect(function(deltaTime)
        if not LocalPlayer.Character or not aimAssistEnabled then return end
        local myRoot = LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
        if not myRoot then return end
        
        local target = getTargetInView()
        if target and target.Character then
            local head = target.Character:FindFirstChild("Head")
            local humanoidRootPart = target.Character:FindFirstChild("HumanoidRootPart")
            if head and humanoidRootPart then
                -- Minimal velocity prediction for slight correction
                local velocity = humanoidRootPart.Velocity
                local predictedPosition = head.Position + (velocity * PREDICTION_FACTOR * deltaTime)
                
                -- Instant, perfect tracking
                Camera.CFrame = CFrame.lookAt(Camera.CFrame.Position, predictedPosition)
            end
        end
    end)
end

-- Toggle aim assist with F key and disable default camera input
local cameraInputDisabled = false
UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if gameProcessed then return end
    if input.KeyCode == Enum.KeyCode.F then
        aimAssistEnabled = not aimAssistEnabled
        if aimAssistEnabled and not cameraInputDisabled then
            UserInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
            cameraInputDisabled = true
        elseif not aimAssistEnabled and cameraInputDisabled then
            UserInputService.MouseBehavior = Enum.MouseBehavior.Default
            cameraInputDisabled = false
        end
        print("Aim assist " .. (aimAssistEnabled and "enabled" or "disabled"))
    end
end)

-- Optimize ESP updates
local frameCounter = 0
local updateInterval = 5
RunService.RenderStepped:Connect(function()
    frameCounter = frameCounter + 1
    if frameCounter >= updateInterval then
        updateESP()
        frameCounter = 0
    end
end)

-- Connect to player added event
Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        if player ~= LocalPlayer then
            createESP(character)
        end
    end)
    
    player.CharacterRemoving:Connect(function(character)
        removeESP(character)
    end)
end)

-- Remove ESP when player leaves
Players.PlayerRemoving:Connect(function(player)
    if player.Character then
        removeESP(player.Character)
    end
end)

-- Initial setup for existing players
for _, player in pairs(Players:GetPlayers()) do
    if player ~= LocalPlayer and player.Character then
        createESP(player.Character)
    end
end

-- Clean up and update when local player respawns
LocalPlayer.CharacterAdded:Connect(function(character)
    for _, player in pairs(Players:GetPlayers()) do
        if player.Character then
            removeESP(player.Character)
            if player ~= LocalPlayer then
                createESP(player.Character)
            end
        end
    end
    startAimAssist()
end)

-- Start aim assist initially (off by default)
startAimAssist()

Features & Information

f to toggle it

Community Comments (1)

AxelSigmaAxelSigmaMar 26, 2025(edited)

esp works but aimbot not so much or not working i dont know either

More Scripts for Arsenal