Chat
Ask me anything
Ithy Logo

Advanced Debug ESP Script for Roblox

A comprehensive Luau code for players with highlighting, health bars, and name tags

roblox game scenery

Highlights

  • R6/R15 Support: Seamlessly handles both character models.
  • Mobile Compatibility: Efficient design that works across devices.
  • Complete Visuals: Features include highlights, continuously updated health bars, dynamic name tags, and movement tracking.

Overview

This advanced debug ESP script is designed to help developers quickly diagnose and debug player states in a Roblox game. The script employs the power of Luau and the Roblox Drawing library for visual overlays such as highlighting players, displaying health bars, and showing name tags. It supports both R6 and R15 character models and is optimized for mobile devices.

Key Features

  • Highlights all players in the game using colored outlines.
  • Displays dynamic health bars that update automatically to reflect a player's current and maximum health.
  • Renders name tags above characters for easy identification.
  • Supports both the traditional R6 and modern R15 character rigs.
  • Mobile support ensured via efficient rendering and minimal GUI elements.
  • Utilizes BillboardGuis for health bars and name tags, and the Highlight instance for robust visual indication.

Script Details

The script is designed to run on the client (LocalScript) and leverages Roblox services to loop through all current players. It attaches ESP elements to every player’s character once their model is loaded. The health bars and name tags are implemented using BillboardGui, ensuring they remain correctly positioned relative to the player's head and body, even as the character moves. This solution also includes automatic updates on health changes, ensuring the display always reflects the current game state.

Implementation Details

Core Roblox Services

The script accesses primary Roblox services like Players, RunService, and UserInputService to track game updates, render visuals, and handle user inputs. The usage of RenderStepped ensures that ESP elements update in real-time.

GUI and Highlight Setup

Visual elements such as the health bars and name tags are created using BillboardGui components. The Highlight instance provides an immediate outline effect, clearly marking each character. The code also dynamically handles character load and respawn events, ensuring that all players continue to display the ESP elements seamlessly.

The Code


--[[ 
Advanced Debug ESP Script
Supports R6 and R15 characters including mobile compatibility.
This script highlights all players, provides health bars, and displays name tags.
Place this code in a LocalScript.
--]]

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

local LocalPlayer = Players.LocalPlayer
local Camera = Workspace.CurrentCamera

-- Configuration settings
local ESPConfig = {
    HighlightColor = Color3.new(1, 0, 0),         -- Red outline color
    HealthBarColor = Color3.new(0, 1, 0),           -- Green health bar
    NameTagColor = Color3.new(1, 1, 1),             -- White text for name tags
    TagOffset = Vector3.new(0, 2.5, 0),
    ESPEnabled = true,                            -- Toggle with F3 key below
    MaxDistance = 1000                            -- Maximum distance for ESP display
}

-- Function to create BillboardGui for health bar and name tag
local function createBillboardGui(parent, offset, guiSize)
    local billboardGui = Instance.new("BillboardGui")
    billboardGui.Adornee = parent
    billboardGui.Parent = parent
    billboardGui.StudsOffset = offset or Vector3.new(0, 3, 0)
    billboardGui.AlwaysOnTop = true
    billboardGui.Size = guiSize or UDim2.new(0, 100, 0, 30)
    return billboardGui
end

-- Function to create ESP objects for a character
local function setupESPForCharacter(character)
    if not character or not character:FindFirstChild("Humanoid") then return end

    -- Add Highlight
    local highlight = Instance.new("Highlight")
    highlight.Name = "ESP_Highlight"
    highlight.FillTransparency = 1  -- Hide internal fill
    highlight.OutlineColor = ESPConfig.HighlightColor
    highlight.OutlineTransparency = 0
    highlight.Parent = character
    
    local rootPart = character:FindFirstChild("HumanoidRootPart")
    if not rootPart then return end

    -- Create Health Bar GUI
    local healthGui = createBillboardGui(rootPart, Vector3.new(0, 2, 0), UDim2.new(0, 110, 0, 15))
    local bgFrame = Instance.new("Frame", healthGui)
    bgFrame.BackgroundColor3 = Color3.new(0, 0, 0)
    bgFrame.Size = UDim2.new(1, 0, 1, 0)
    bgFrame.BorderSizePixel = 0

    local healthBar = Instance.new("Frame", bgFrame)
    healthBar.Name = "HealthBar"
    healthBar.BackgroundColor3 = ESPConfig.HealthBarColor
    healthBar.Size = UDim2.new(1, 0, 1, 0)  -- Full health initially
    healthBar.BorderSizePixel = 0

    -- Create NameTag GUI
    local nameGui = createBillboardGui(rootPart, Vector3.new(0, 3.5, 0), UDim2.new(0, 200, 0, 50))
    local nameLabel = Instance.new("TextLabel", nameGui)
    nameLabel.Text = character.Name
    nameLabel.TextColor3 = ESPConfig.NameTagColor
    nameLabel.BackgroundTransparency = 1
    nameLabel.Size = UDim2.new(1, 0, 1, 0)
    nameLabel.Font = Enum.Font.SourceSansBold
    nameLabel.TextScaled = true

    -- Function to update the health bar based on current health
    local humanoid = character:FindFirstChild("Humanoid")
    local function updateHealthBar()
        if humanoid and humanoid.MaxHealth > 0 then
            local healthPercent = math.clamp(humanoid.Health / humanoid.MaxHealth, 0, 1)
            healthBar.Size = UDim2.new(healthPercent, 0, 1, 0)
        end
    end

    humanoid.HealthChanged:Connect(updateHealthBar)
    updateHealthBar()
end

-- Function to apply ESP to all current players
local function applyESPToPlayers()
    for _, player in ipairs(Players:GetPlayers()) do
        if player ~= LocalPlayer and player.Character then
            setupESPForCharacter(player.Character)
            -- Listen for character respawn/reload
            player.CharacterAdded:Connect(function(newCharacter)
                wait(0.5) -- Delay to ensure character parts are loaded
                setupESPForCharacter(newCharacter)
            end)
        end
    end
end

applyESPToPlayers()

-- Connect for new players who join the game
Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(newCharacter)
        wait(0.5)
        setupESPForCharacter(newCharacter)
    end)
end)

-- Toggle ESP on/off using F3 key
UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if gameProcessed then return end
    if input.KeyCode == Enum.KeyCode.F3 then
        ESPConfig.ESPEnabled = not ESPConfig.ESPEnabled
        for _, player in ipairs(Players:GetPlayers()) do
            if player.Character then
                local highlight = player.Character:FindFirstChild("ESP_Highlight")
                if highlight then
                    highlight.Enabled = ESPConfig.ESPEnabled
                end
                
                local root = player.Character:FindFirstChild("HumanoidRootPart")
                if root then
                    local billboards = root:GetChildren()
                    for _, child in ipairs(billboards) do
                        if child:IsA("BillboardGui") then
                            child.Enabled = ESPConfig.ESPEnabled
                        end
                    end
                end
            end
        end
    end
end)

print("Advanced Debug ESP Script Loaded - Press F3 to toggle ESP")
  

Feature Comparison Table

Feature Description
Player Highlight Highlights player models with a colored outline.
Health Bars Dynamic BillboardGui-based bars updating in real time with health changes.
Name Tags Displays player names above characters for easy identification.
R6/R15 Support Works seamlessly with both classic and modern character rigs.
Mobile Compatibility Optimized for efficient performance on mobile devices.
Toggle Feature Enable or disable ESP with the F3 key for quick debugging.

References


Recommended Topics


Last updated March 3, 2025
Ask Ithy AI
Download Article
Delete Article