Box esp green
Key RequiredUniversal

Box esp green

Universal Scriptfelipenagibeaumfelipenagibeaum 2.1K views 14 executesUpdated May 3, 2025
5.0/ 5(1 votes)
10100% Positive
Lua Script•155 lines (5415 chars)
local ESP_SETTINGS = {
    Enabled = true,
    TeamCheck = true,
    ShowName = true,
    ShowDistance = true,
    ShowHealth = true,
    BoxESP = true,
    TeamColor = Color3.fromRGB(0, 255, 0),
    EnemyColor = Color3.fromRGB(255, 0, 0),
    MaxDistance = 1000
}

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local RunService = game:GetService("RunService")
local Camera = workspace.CurrentCamera

local function IsTeammate(player)
    if not ESP_SETTINGS.TeamCheck then return false end
    return player.Team == LocalPlayer.Team
end

local function CreateESP(player)
    if player == LocalPlayer then return end

    local espData = {
        connections = {},
        drawings = {
            text = Drawing.new("Text"),
            box = Drawing.new("Square")
        }
    }

    for _, drawing in pairs(espData.drawings) do
        drawing.Visible = false
    end

    espData.drawings.text.Center = true
    espData.drawings.text.Outline = true
    espData.drawings.text.Font = 2
    espData.drawings.text.Size = 14

    espData.drawings.box.Thickness = 1
    espData.drawings.box.Filled = false

    local function UpdateCharacter()
        for _, conn in ipairs(espData.connections) do
            conn:Disconnect()
        end
        espData.connections = {}

        local character = player.Character or player.CharacterAdded:Wait()
        local humanoid = character:WaitForChild("Humanoid")
        local humanoidRootPart = character:WaitForChild("HumanoidRootPart")

        local healthConn = humanoid:GetPropertyChangedSignal("Health"):Connect(function()
            if humanoid.Health <= 0 then
                espData.drawings.text.Visible = false
                espData.drawings.box.Visible = false
            end
        end)
        table.insert(espData.connections, healthConn)

        local renderConn = RunService.RenderStepped:Connect(function()
            if not ESP_SETTINGS.Enabled or not character or not humanoidRootPart or not humanoid or humanoid.Health <= 0 then
                espData.drawings.text.Visible = false
                espData.drawings.box.Visible = false
                return
            end

            local distance = (LocalPlayer.Character.HumanoidRootPart.Position - humanoidRootPart.Position).Magnitude
            if distance > ESP_SETTINGS.MaxDistance then
                espData.drawings.text.Visible = false
                espData.drawings.box.Visible = false
                return
            end

            local screenPos, onScreen = Camera:WorldToViewportPoint(humanoidRootPart.Position)
            if not onScreen then
                espData.drawings.text.Visible = false
                espData.drawings.box.Visible = false
                return
            end

            local color = IsTeammate(player) and ESP_SETTINGS.TeamColor or ESP_SETTINGS.EnemyColor

            local infoText = ""
            if ESP_SETTINGS.ShowName then infoText = player.Name.."\n" end
            if ESP_SETTINGS.ShowDistance then infoText = infoText..string.format("%.1f studs\n", distance) end
            if ESP_SETTINGS.ShowHealth then infoText = infoText..string.format("HP: %d", humanoid.Health) end

            espData.drawings.text.Text = infoText
            espData.drawings.text.Position = Vector2.new(screenPos.X, screenPos.Y)
            espData.drawings.text.Color = color
            espData.drawings.text.Visible = true

            if ESP_SETTINGS.BoxESP then
                local height = 50 / (distance * 0.1)
                local width = height / 2
                espData.drawings.box.Size = Vector2.new(width, height)
                espData.drawings.box.Position = Vector2.new(screenPos.X - width/2, screenPos.Y - height/2)
                espData.drawings.box.Color = color
                espData.drawings.box.Visible = true
            else
                espData.drawings.box.Visible = false
            end
        end)
        table.insert(espData.connections, renderConn)
    end

    player.CharacterAdded:Connect(UpdateCharacter)
    table.insert(espData.connections, player.CharacterAdded:Connect(UpdateCharacter))

    player.CharacterRemoving:Connect(function()
        espData.drawings.text.Visible = false
        espData.drawings.box.Visible = false
    end)
    table.insert(espData.connections, player.CharacterRemoving:Connect(function()
        espData.drawings.text.Visible = false
        espData.drawings.box.Visible = false
    end))

    player:GetPropertyChangedSignal("Parent"):Connect(function()
        if not player.Parent then
            for _, conn in ipairs(espData.connections) do
                conn:Disconnect()
            end
            for _, drawing in pairs(espData.drawings) do
                drawing:Remove()
            end
        end
    end)
    table.insert(espData.connections, player:GetPropertyChangedSignal("Parent"):Connect(function()
        if not player.Parent then
            for _, conn in ipairs(espData.connections) do
                conn:Disconnect()
            end
            for _, drawing in pairs(espData.drawings) do
                drawing:Remove()
            end
        end
    end))

    UpdateCharacter()
end

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

Players.PlayerAdded:Connect(function(player)
    CreateESP(player)
end)

Features & Information

Esp,health,Box and name
#esp#box#green#health#name

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts