Esp 2d UPDATE
Key RequiredUniversal

Esp 2d UPDATE

Universal ScriptNguyenvubaoNguyenvubao 21 views 1.1K executesUpdated Aug 5, 2026
Unrated
00
Lua Script•109 lines (3729 chars)
-- Services
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local CoreGui = game:GetService("CoreGui")
local LocalPlayer = Players.LocalPlayer
local Camera = workspace.CurrentCamera

-- Biến trạng thái Bật/Tắt
local ESPEnabled = false

-- Khởi tạo ESP cho một Player
local function CreateESP(player)
    -- Khung vuông (Box)
    local Box = Drawing.new("Square")
    Box.Visible = false
    Box.Color = Color3.fromRGB(255, 255, 0) -- Màu vàng
    Box.Thickness = 1.5
    Box.Transparency = 1
    Box.Filled = false

    -- Đường gạch (Tracer Line)
    local Line = Drawing.new("Line")
    Line.Visible = false
    Line.Color = Color3.fromRGB(255, 255, 255) -- Màu trắng
    Line.Thickness = 1
    Line.Transparency = 1

    local Connection
    Connection = RunService.RenderStepped:Connect(function()
        if ESPEnabled and player.Character and player.Character:FindFirstChild("HumanoidRootPart") and player.Character:FindFirstChild("Humanoid") and player.Character.Humanoid.Health > 0 then
            local HRP = player.Character.HumanoidRootPart
            local Vector, OnScreen = Camera:WorldToViewportPoint(HRP.Position)

            if OnScreen then
                -- Tính toán chính xác vị trí đỉnh đầu và chân nhân vật
                local HeadPos = Camera:WorldToViewportPoint(HRP.Position + Vector3.new(0, 3, 0))
                local FeetPos = Camera:WorldToViewportPoint(HRP.Position - Vector3.new(0, 3.5, 0))

                local Height = math.abs(HeadPos.Y - FeetPos.Y)
                local Width = Height / 1.5

                -- Cập nhật Box
                Box.Size = Vector2.new(Width, Height)
                Box.Position = Vector2.new(Vector.X - Width / 2, Vector.Y - Height / 2)
                Box.Visible = true

                -- Cập nhật đường gạch nối từ giữa mép dưới màn hình đến chân nhân vật
                Line.From = Vector2.new(Camera.ViewportSize.X / 2, Camera.ViewportSize.Y)
                Line.To = Vector2.new(Vector.X, Vector.Y + Height / 2)
                Line.Visible = true
            else
                Box.Visible = false
                Line.Visible = false
            end
        else
            Box.Visible = false
            Line.Visible = false
        end

        -- Xóa Drawing khi người chơi thoát
        if not player or not player.Parent then
            Box:Remove()
            Line:Remove()
            Connection:Disconnect()
        end
    end)
end

-- Lắng nghe người chơi mới và người chơi hiện tại
for _, player in pairs(Players:GetPlayers()) do
    if player ~= LocalPlayer then
        CreateESP(player)
    end
end

Players.PlayerAdded:Connect(function(player)
    if player ~= LocalPlayer then
        CreateESP(player)
    end
end)

-- Tạo GUI nút Bật/Tắt
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "ESP_Toggle_UI"
ScreenGui.ResetOnSpawn = false
ScreenGui.Parent = CoreGui

local ToggleButton = Instance.new("TextButton")
ToggleButton.Parent = ScreenGui
ToggleButton.Size = UDim2.new(0, 120, 0, 40)
ToggleButton.Position = UDim2.new(0.02, 0, 0.4, 0)
ToggleButton.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
ToggleButton.Text = "ESP 2D: OFF"
ToggleButton.TextColor3 = Color3.fromRGB(255, 255, 255)
ToggleButton.TextSize = 16
ToggleButton.Font = Enum.Font.SourceSansBold
ToggleButton.Active = true
ToggleButton.Draggable = true

ToggleButton.MouseButton1Click:Connect(function()
    ESPEnabled = not ESPEnabled
    if ESPEnabled then
        ToggleButton.Text = "ESP 2D: ON"
        ToggleButton.BackgroundColor3 = Color3.fromRGB(50, 200, 50)
    else
        ToggleButton.Text = "ESP 2D: OFF"
        ToggleButton.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
    end
end)

Features & Information

Script esp 2D has updated

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts