Universal NPC Highlight (Humanoid Corpses Included)
Key RequiredUniversal

Universal NPC Highlight (Humanoid Corpses Included)

Universal Scriptschlawschlaw 836 views 2.5K executesUpdated Sep 13, 2026
Unrated
00
Lua Script•259 lines (8636 chars)
-- NPC Highlight Script
-- Toggle with [ key
-- Shows NPCs through walls with names and highlights

-- Services
local Workspace = game:GetService("Workspace")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")

local Camera = Workspace.CurrentCamera
local highlightEnabled = true

-- Colors for NPCs
local npcColor = Color3.fromRGB(255, 165, 0)  -- Orange for NPCs
local enemyColor = Color3.fromRGB(255, 50, 50)  -- Red for enemies
local friendlyColor = Color3.fromRGB(50, 255, 50)  -- Green for friendlies

-- Store NPC highlights
local npcHighlights = {}

-- Function to check if something is an NPC
local function isNPC(model)
    -- Common NPC indicators
    if not model:IsA("Model") then return false end
    if model:FindFirstChild("Humanoid") then
        -- Check for NPC name patterns
        local name = model.Name:lower()
        if name:find("npc") or 
           name:find("bot") or 
           name:find("enemy") or 
           name:find("zombie") or
           name:find("mob") or
           name:find("creature") or
           name:find("boss") or
           name:find("guard") or
           name:find("soldier") or
           name:find("bandit") or
           name:find("monster") or
           name:find("animal") then
            return true
        end
        
        -- Check if it's not a player (no Player property)
        if not game:GetService("Players"):GetPlayerFromCharacter(model) then
            return true
        end
    end
    return false
end

-- Get color based on NPC type
local function getNPCColor(npcName)
    local name = npcName:lower()
    if name:find("enemy") or name:find("zombie") or name:find("boss") or name:find("guard") or name:find("bandit") or name:find("monster") then
        return enemyColor
    elseif name:find("friendly") or name:find("ally") or name:find("villager") or name:find("merchant") or name:find("trader") then
        return friendlyColor
    else
        return npcColor  -- Default orange
    end
end

-- Create highlight for an NPC
local function createNPCHighlight(npcModel)
    if npcHighlights[npcModel] then return end
    
    local highlight = {
        main = nil,
        nameTag = nil,
        nameLabel = nil
    }
    
    -- Create main highlight
    highlight.main = Instance.new("Highlight")
    highlight.main.Name = "NPC_Highlight"
    highlight.main.Adornee = npcModel
    highlight.main.FillColor = getNPCColor(npcModel.Name)
    highlight.main.FillTransparency = 0.7
    highlight.main.OutlineColor = getNPCColor(npcModel.Name)
    highlight.main.OutlineTransparency = 0
    highlight.main.Enabled = highlightEnabled
    highlight.main.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop
    highlight.main.Parent = npcModel
    
    -- Create name tag if NPC has a head
    local head = npcModel:FindFirstChild("Head") or npcModel:FindFirstChild("UpperTorso")
    if head then
        local nameTag = Instance.new("BillboardGui")
        nameTag.Name = "NPC_NameTag"
        nameTag.Adornee = head
        nameTag.AlwaysOnTop = true
        nameTag.StudsOffset = Vector3.new(0, 3, 0)
        nameTag.MaxDistance = 0  -- Infinite distance
        
        -- Simple text label (no background)
        local nameLabel = Instance.new("TextLabel")
        nameLabel.Name = "Label"
        nameLabel.Size = UDim2.new(1, 0, 1, 0)
        nameLabel.BackgroundTransparency = 1
        nameLabel.Text = npcModel.Name
        nameLabel.TextColor3 = getNPCColor(npcModel.Name)
        nameLabel.TextStrokeColor3 = Color3.new(0, 0, 0)
        nameLabel.TextStrokeTransparency = 0.2
        nameLabel.Font = Enum.Font.GothamBold
        nameLabel.TextSize = 14
        nameLabel.TextScaled = false
        nameLabel.TextXAlignment = Enum.TextXAlignment.Center
        nameLabel.TextYAlignment = Enum.TextYAlignment.Center
        
        nameLabel.Parent = nameTag
        nameTag.Parent = head
        
        highlight.nameTag = nameTag
        highlight.nameLabel = nameLabel
        nameTag.Enabled = highlightEnabled
    end
    
    npcHighlights[npcModel] = highlight
    
    -- Listen for NPC death/removal
    local humanoid = npcModel:FindFirstChild("Humanoid")
    if humanoid then
        humanoid.Died:Connect(function()
            if npcHighlights[npcModel] then
                local h = npcHighlights[npcModel]
                if h.main then h.main:Destroy() end
                if h.nameTag then h.nameTag:Destroy() end
                npcHighlights[npcModel] = nil
            end
        end)
    end
end

-- Scan for NPCs in the workspace
local function scanForNPCs()
    for _, model in pairs(Workspace:GetChildren()) do
        if isNPC(model) and not npcHighlights[model] then
            createNPCHighlight(model)
        end
    end
    
    -- Also check inside folders
    for _, folder in pairs(Workspace:GetDescendants()) do
        if folder:IsA("Folder") or folder:IsA("Model") then
            for _, model in pairs(folder:GetChildren()) do
                if isNPC(model) and not npcHighlights[model] then
                    createNPCHighlight(model)
                end
            end
        end
    end
end

-- Update name sizes based on distance
local function updateNameSizes()
    if not highlightEnabled then return end
    
    for npcModel, highlight in pairs(npcHighlights) do
        if highlight.nameTag and highlight.nameLabel then
            local head = npcModel:FindFirstChild("Head") or npcModel:FindFirstChild("UpperTorso")
            if head and highlight.nameTag.Enabled then
                -- Calculate distance from camera to NPC
                local distance = (head.Position - Camera.CFrame.Position).Magnitude
                
                -- Scale text based on distance
                local scale = math.clamp(distance / 50, 0.6, 1.8)
                local textSize = math.floor(12 * scale)
                textSize = math.clamp(textSize, 8, 20)
                
                -- Update text size
                highlight.nameLabel.TextSize = textSize
                
                -- Adjust Billboard size
                local tagWidth = math.clamp(textSize * 8, 80, 200)
                local tagHeight = math.clamp(textSize * 1.5, 20, 40)
                highlight.nameTag.Size = UDim2.new(0, tagWidth, 0, tagHeight)
            end
        end
    end
end

-- Toggle highlights with [ key
UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if gameProcessed then return end
    
    if input.KeyCode == Enum.KeyCode.LeftBracket then
        highlightEnabled = not highlightEnabled
        
        -- Update all NPC highlights
        for _, highlight in pairs(npcHighlights) do
            if highlight.main then
                highlight.main.Enabled = highlightEnabled
            end
            if highlight.nameTag then
                highlight.nameTag.Enabled = highlightEnabled
            end
        end
        
        print("NPC Highlights: " .. (highlightEnabled and "ON" or "OFF"))
    end
end)

-- Initial scan for NPCs
scanForNPCs()

-- Regular scanning for new NPCs
spawn(function()
    while true do
        task.wait(2)  -- Scan every 2 seconds
        pcall(scanForNPCs)
    end
end)

-- Update name sizes in real-time
local renderConnection
renderConnection = RunService.RenderStepped:Connect(function()
    pcall(updateNameSizes)
end)

-- Listen for new NPCs being added
Workspace.DescendantAdded:Connect(function(descendant)
    if descendant:IsA("Model") and isNPC(descendant) then
        task.wait(0.5)  -- Small delay to ensure NPC is fully loaded
        if not npcHighlights[descendant] then
            createNPCHighlight(descendant)
        end
    end
end)

-- Cleanup function
local function cleanup()
    if renderConnection then
        renderConnection:Disconnect()
    end
    
    for _, highlight in pairs(npcHighlights) do
        if highlight.main then
            pcall(function() highlight.main:Destroy() end)
        end
        if highlight.nameTag then
            pcall(function() highlight.nameTag:Destroy() end)
        end
    end
    
    npcHighlights = {}
end

print("======================================")
print("NPC Highlight Script Loaded")
print("======================================")
print("Features:")
print("- Highlights all NPCs through walls")
print("- Shows NPC names with distance scaling")
print("- Color coded: Orange = NPC, Red = Enemy, Green = Friendly")
print("- Auto-detects new NPCs")
print("- Works with any executor")
print("")
print("Press [ to toggle ON/OFF")
print("======================================")

Features & Information

"Best NPC Highlight Script On The Web." "Toggle by pressing [" "1-Works for infinite distances!" "2-Completely Universal!" "3-Has color coding for NPC types!" "4-Has username scaling!" "5-Auto-detects new NPCs!"
#ESP Highlight NPC Universal Wallhack Corpse#Toggle Keybind Open Source Free Clean

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts