UNIVERSAL AIMBOT AND ESP
Key RequiredUniversal

UNIVERSAL AIMBOT AND ESP

Universal Scriptmuhammadahmadyaqoobmuhammadahmadyaqoob 3.7K views 10.1K executesUpdated Jun 18, 2026
Unrated
00
Lua Script•324 lines (9894 chars)
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")

local LocalPlayer = Players.LocalPlayer
local Camera = workspace.CurrentCamera

-- ===== RAYFIELD =====
local Rayfield = loadstring(game:HttpGet('https://sirius.menu/rayfield'))()

local Window = Rayfield:CreateWindow({
    Name = "Player Utilities",
    LoadingTitle = "Player Utilities",
    LoadingSubtitle = "Loading...",
    ConfigurationSaving = { Enabled = false },
    Discord = { Enabled = false },
    KeySystem = false,
})

local LockTab = Window:CreateTab("Lock On", nil)
local ESPTab = Window:CreateTab("ESP", nil)

-- ===== STATE =====
local lockEnabled = false
local lockRange = 150
local lockedTarget = nil
local lockLoop = nil

local espEnabled = false
local espData = {}

-- ===== UTILITY =====
local function isVisible(targetHead)
    if not targetHead then return false end

    local origin = Camera.CFrame.Position
    local direction = targetHead.Position - origin

    local rayParams = RaycastParams.new()
    rayParams.FilterType = Enum.RaycastFilterType.Exclude

    local excludeList = {}
    if LocalPlayer.Character then
        table.insert(excludeList, LocalPlayer.Character)
    end
    if targetHead.Parent then
        table.insert(excludeList, targetHead.Parent)
    end
    rayParams.FilterDescendantsInstances = excludeList

    local result = workspace:Raycast(origin, direction, rayParams)
    if not result then return true end

    local hitDist = (result.Position - origin).Magnitude
    local headDist = direction.Magnitude
    return hitDist >= headDist - 1
end

local function getHealth(player)
    local char = player.Character
    if not char then return 0, 100 end
    local h = char:FindFirstChildOfClass("Humanoid")
    if not h then return 0, 100 end
    return h.Health, h.MaxHealth
end

-- ===== ESP =====
local function buildESP(player)
    if player == LocalPlayer then return end
    if espData[player] then return end

    local function tryAttach()
        local character = player.Character
        if not character then return end

        local highlight = Instance.new("Highlight")
        highlight.FillColor = Color3.fromRGB(255, 50, 50)
        highlight.OutlineColor = Color3.fromRGB(255, 255, 255)
        highlight.FillTransparency = 0.4
        highlight.OutlineTransparency = 0
        highlight.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop -- shows through walls
        highlight.Parent = character

        local head = character:FindFirstChild("Head")
        local billboard, hpBar, hpFill, nameLbl

        if head then
            billboard = Instance.new("BillboardGui")
            billboard.Name = "ESP_Billboard"
            billboard.Size = UDim2.new(0, 120, 0, 40)
            billboard.StudsOffset = Vector3.new(0, 2.5, 0)
            billboard.AlwaysOnTop = true
            billboard.Parent = head

            nameLbl = Instance.new("TextLabel")
            nameLbl.Size = UDim2.new(1, 0, 0.5, 0)
            nameLbl.BackgroundTransparency = 1
            nameLbl.Text = player.Name
            nameLbl.TextColor3 = Color3.fromRGB(255, 255, 255)
            nameLbl.TextStrokeTransparency = 0
            nameLbl.Font = Enum.Font.GothamBold
            nameLbl.TextScaled = true
            nameLbl.Parent = billboard

            -- HP bar background
            hpBar = Instance.new("Frame")
            hpBar.Size = UDim2.new(1, 0, 0.3, 0)
            hpBar.Position = UDim2.new(0, 0, 0.65, 0)
            hpBar.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
            hpBar.BorderSizePixel = 0
            hpBar.Parent = billboard

            -- HP bar fill
            hpFill = Instance.new("Frame")
            hpFill.Size = UDim2.new(1, 0, 1, 0)
            hpFill.BackgroundColor3 = Color3.fromRGB(80, 255, 80)
            hpFill.BorderSizePixel = 0
            hpFill.Parent = hpBar
        end

        espData[player] = {
            highlight = highlight,
            billboard = billboard,
            hpFill = hpFill,
            nameLbl = nameLbl,
        }
    end

    tryAttach()

    player.CharacterAdded:Connect(function()
        task.wait(0.5)
        -- clean old
        if espData[player] then
            if espData[player].highlight then espData[player].highlight:Destroy() end
            if espData[player].billboard then espData[player].billboard:Destroy() end
            espData[player] = nil
        end
        tryAttach()
    end)
end

local function removeESP(player)
    local data = espData[player]
    if data then
        if data.highlight then data.highlight:Destroy() end
        if data.billboard then data.billboard:Destroy() end
        espData[player] = nil
    end
end

local function refreshAllESP()
    for _, player in ipairs(Players:GetPlayers()) do
        if espEnabled then
            buildESP(player)
        else
            removeESP(player)
        end
    end
end

-- update hp bars every frame
RunService.RenderStepped:Connect(function()
    if not espEnabled then return end
    for player, data in pairs(espData) do
        if data.hpFill then
            local hp, maxHp = getHealth(player)
            local pct = math.clamp(hp / maxHp, 0, 1)
            data.hpFill.Size = UDim2.new(pct, 0, 1, 0)
            -- green -> yellow -> red based on hp
            data.hpFill.BackgroundColor3 = Color3.fromRGB(
                math.floor(255 * (1 - pct)),
                math.floor(255 * pct),
                0
            )
        end
        -- highlight locked target in different color
        if data.highlight then
            if lockedTarget == player then
                data.highlight.FillColor = Color3.fromRGB(255, 200, 0)
                data.highlight.OutlineColor = Color3.fromRGB(255, 255, 0)
            else
                data.highlight.FillColor = Color3.fromRGB(255, 50, 50)
                data.highlight.OutlineColor = Color3.fromRGB(255, 255, 255)
            end
        end
    end
end)

Players.PlayerAdded:Connect(function(player)
    if espEnabled then
        task.wait(0.5)
        buildESP(player)
    end
end)

Players.PlayerRemoving:Connect(function(player)
    removeESP(player)
end)

-- ===== LOCK ON =====
local function findBestTarget()
    local bestPlayer = nil
    local bestScore = math.huge
    local screenCenter = Vector2.new(Camera.ViewportSize.X / 2, Camera.ViewportSize.Y / 2)

    for _, player in ipairs(Players:GetPlayers()) do
        if player == LocalPlayer then continue end

        local character = player.Character
        if not character then continue end

        local head = character:FindFirstChild("Head")
        if not head then continue end

        local humanoid = character:FindFirstChildOfClass("Humanoid")
        if not humanoid or humanoid.Health <= 0 then continue end

        local worldDist = (head.Position - Camera.CFrame.Position).Magnitude
        if worldDist > lockRange then continue end

        local screenPos, onScreen = Camera:WorldToScreenPoint(head.Position)
        if not onScreen then continue end

        if not isVisible(head) then continue end

        -- score = screen distance from center, weighted slightly by world distance
        local screenDist = (Vector2.new(screenPos.X, screenPos.Y) - screenCenter).Magnitude
        local score = screenDist + (worldDist * 0.1)

        if score < bestScore then
            bestScore = score
            bestPlayer = player
        end
    end

    return bestPlayer
end

local function startLock()
    if lockLoop then lockLoop:Disconnect() end

    lockLoop = RunService.RenderStepped:Connect(function()
        -- validate current target
        if lockedTarget then
            local char = lockedTarget.Character
            local head = char and char:FindFirstChild("Head")
            local humanoid = char and char:FindFirstChildOfClass("Humanoid")
            local worldDist = head and (head.Position - Camera.CFrame.Position).Magnitude or math.huge

            if not head
                or not humanoid
                or humanoid.Health <= 0
                or worldDist > lockRange
                or not isVisible(head) then
                lockedTarget = nil
            end
        end

        -- find new target if none
        if not lockedTarget then
            lockedTarget = findBestTarget()
        end

        -- lock camera to head
        if lockedTarget then
            local char = lockedTarget.Character
            local head = char and char:FindFirstChild("Head")
            if head then
                Camera.CFrame = CFrame.new(Camera.CFrame.Position, head.Position)
            end
        end
    end)
end

local function stopLock()
    if lockLoop then lockLoop:Disconnect(); lockLoop = nil end
    lockedTarget = nil
end

-- ===== RAYFIELD: LOCK ON TAB =====
LockTab:CreateToggle({
    Name = "Lock On (T to toggle)",
    CurrentValue = false,
    Flag = "LockToggle",
    Callback = function(value)
        lockEnabled = value
        if value then startLock() else stopLock() end
    end,
})

LockTab:CreateSlider({
    Name = "Lock Range",
    Range = {20, 600},
    Increment = 10,
    Suffix = " studs",
    CurrentValue = 150,
    Flag = "LockRange",
    Callback = function(value)
        lockRange = value
    end,
})

-- ===== RAYFIELD: ESP TAB =====
ESPTab:CreateToggle({
    Name = "Player Highlight (through walls)",
    CurrentValue = false,
    Flag = "ESPToggle",
    Callback = function(value)
        espEnabled = value
        refreshAllESP()
    end,
})

-- ===== PC KEYBIND =====
UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if gameProcessed then return end
    if input.KeyCode == Enum.KeyCode.T then
        lockEnabled = not lockEnabled
        if lockEnabled then startLock() else stopLock() end
    end
end)

Rayfield:LoadConfiguration()

Features & Information

AIMBOT WITH WALL CHECK AND ESP UNIVERSAL

Community Comments (2)

THIS HAVE SOME BUGS IN RIVALS BUT STILL WORKS WELL ITS ANTI BAN COMMENT IF YOU WANT ME TO MAKE IT A MORE BETTER SCRIPT WITH MORE FEATURES

kohwestley145kohwestley145Jun 24, 2026

THIS WORKS REALLY WELL but i think team check wall check and body/torso check wouldvee made it the best

More Scripts for Universal Scripts