esp with tracer
Key RequiredUniversal

esp with tracer

Universal Scriptgw87gw87 2.3K views 231 executesUpdated Sep 17, 2025
Unrated
00
Lua Script•178 lines (5360 chars)
-- Advanced ESP Script for Krnl executor

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

local espFolder = Instance.new("Folder")
espFolder.Name = "AdvancedESP"
espFolder.Parent = game:GetService("CoreGui")

local espObjects = {}

-- Fungsi untuk membuat ESP pada pemain
local function createESP(player)
    if player == LocalPlayer then return end
    local character = player.Character
    if not character or not character:FindFirstChild("HumanoidRootPart") then return end

    local hrp = character.HumanoidRootPart

    -- Box
    local box = Instance.new("BoxHandleAdornment")
    box.Adornee = hrp
    box.Size = Vector3.new(4, 6, 1)
    box.Transparency = 0.6
    box.ZIndex = 10
    box.AlwaysOnTop = true
    box.Parent = espFolder

    -- Health Bar
    local healthBar = Instance.new("BillboardGui")
    healthBar.Adornee = hrp
    healthBar.Size = UDim2.new(0, 60, 0, 10)
    healthBar.StudsOffset = Vector3.new(0, 3.5, 0)
    healthBar.AlwaysOnTop = true
    healthBar.Parent = espFolder

    local healthFrame = Instance.new("Frame")
    healthFrame.Size = UDim2.new(1, 0, 1, 0)
    healthFrame.BackgroundColor3 = Color3.new(0, 0, 0)
    healthFrame.BorderSizePixel = 0
    healthFrame.Parent = healthBar

    local healthFill = Instance.new("Frame")
    healthFill.Size = UDim2.new(1, 0, 1, 0)
    healthFill.BackgroundColor3 = Color3.new(0, 1, 0)
    healthFill.BorderSizePixel = 0
    healthFill.Parent = healthFrame

    -- Name Tag
    local nameTag = Instance.new("BillboardGui")
    nameTag.Adornee = hrp
    nameTag.Size = UDim2.new(0, 100, 0, 30)
    nameTag.StudsOffset = Vector3.new(0, 4.5, 0)
    nameTag.AlwaysOnTop = true
    nameTag.Parent = espFolder

    local nameLabel = Instance.new("TextLabel")
    nameLabel.Text = player.Name
    nameLabel.Size = UDim2.new(1, 0, 1, 0)
    nameLabel.BackgroundTransparency = 1
    nameLabel.TextColor3 = Color3.new(1, 1, 1)
    nameLabel.TextStrokeColor3 = Color3.new(0, 0, 0)
    nameLabel.TextStrokeTransparency = 0
    nameLabel.Font = Enum.Font.SourceSansBold
    nameLabel.TextScaled = true
    nameLabel.Parent = nameTag

    -- Tracer Line
    local tracer = Drawing.new("Line")
    tracer.Color = Color3.new(1, 0, 0)
    tracer.Thickness = 1.5
    tracer.Transparency = 1

    local function update()
        if not character or not character.Parent then
            tracer:Remove()
            return false
        end

        -- Update box color berdasarkan tim (jika ada)
        local teamColor = player.TeamColor.Color or Color3.new(1, 0, 0)
        box.Color3 = teamColor

        -- Update health bar
        local humanoid = character:FindFirstChildOfClass("Humanoid")
        if humanoid then
            local healthPercent = math.clamp(humanoid.Health / humanoid.MaxHealth, 0, 1)
            healthFill.Size = UDim2.new(healthPercent, 0, 1, 0)

            -- Warna hijau ke merah sesuai health
            healthFill.BackgroundColor3 = Color3.new(1 - healthPercent, healthPercent, 0)
        end

        -- Update tracer line dari kamera ke HumanoidRootPart
        local hrpPos, onScreen = Camera:WorldToViewportPoint(hrp.Position)
        local camPos = Camera.CFrame.Position
        if onScreen then
            tracer.From = Vector2.new(Camera.ViewportSize.X / 2, Camera.ViewportSize.Y)
            tracer.To = Vector2.new(hrpPos.X, hrpPos.Y)
            tracer.Visible = true
        else
            tracer.Visible = false
        end

        return true
    end

    -- Koneksi update per frame
    local connection
    connection = RunService.RenderStepped:Connect(function()
        if not update() then
            connection:Disconnect()
            box:Destroy()
            healthBar:Destroy()
            nameTag:Destroy()
            tracer:Remove()
            espObjects[player] = nil
        end
    end)

    return {
        box = box,
        healthBar = healthBar,
        nameTag = nameTag,
        tracer = tracer,
        connection = connection
    }
end

local function removeESP(player)
    if espObjects[player] then
        local data = espObjects[player]
        if data.connection then data.connection:Disconnect() end
        if data.box then data.box:Destroy() end
        if data.healthBar then data.healthBar:Destroy() end
        if data.nameTag then data.nameTag:Destroy() end
        if data.tracer then data.tracer:Remove() end
        espObjects[player] = nil
    end
end

local function onCharacterAdded(player)
    player.CharacterAdded:Connect(function(character)
        wait(1)
        removeESP(player)
        espObjects[player] = createESP(player)
    end)
    if player.Character then
        removeESP(player)
        espObjects[player] = createESP(player)
    end
end

local function onPlayerAdded(player)
    onCharacterAdded(player)
end

local function onPlayerRemoving(player)
    removeESP(player)
end

-- Init
for _, player in pairs(Players:GetPlayers()) do
    onPlayerAdded(player)
end

Players.PlayerAdded:Connect(onPlayerAdded)
Players.PlayerRemoving:Connect(onPlayerRemoving)

-- Bersihkan saat karakter lokal respawn
LocalPlayer.CharacterAdded:Connect(function()
    for player, _ in pairs(espObjects) do
        removeESP(player)
        onCharacterAdded(player)
    end
end)

Features & Information

Made by AI. Box, tracer,name
#esp

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts