local Players = game:GetService("Players") local RunService = game:GetService("RunService") local LocalPlayer = Players.LocalPlayer local FONT = Enum.Font.Gotham local TEXT_SIZE = 9 local NEUTRAL = Color3.fromRGB(255, 255, 255) local floor = math.floor local UPDATE_EVERY = 4 local esp = {} local function teamColor(p) local team = p.Team if team then local tc = team.TeamColor if tc then return tc.Color end end return NEUTRAL end local function cleanup(p) local d = esp[p] if d then if d.gui1 then d.gui1:Destroy() end if d.gui2 then d.gui2:Destroy() end if d.hl then d.hl:Destroy() end esp[p] = nil end end local function applyColor(p, d) local c = teamColor(p) d.nLabel.TextColor3 = c d.hl.OutlineColor = c end local function onChar(p, char) local old = esp[p] if old then if old.gui1 then old.gui1:Destroy() end if old.gui2 then old.gui2:Destroy() end if old.hl then old.hl:Destroy() end esp[p] = nil end local root = char:WaitForChild("HumanoidRootPart", 5) if not root or not root.Parent or not char.Parent then return end -- name (above head) local gui1 = Instance.new("BillboardGui") gui1.Name = "NameESP" gui1.AlwaysOnTop = true gui1.Size = UDim2.fromOffset(90, 12) gui1.StudsOffsetWorldSpace = Vector3.new(0, 3, 0) gui1.Adornee = root gui1.Parent = root local nLabel = Instance.new("TextLabel") nLabel.BackgroundTransparency = 1 nLabel.Size = UDim2.fromScale(1, 1) nLabel.Font = FONT nLabel.TextSize = TEXT_SIZE nLabel.TextColor3 = Color3.new(1, 1, 1) nLabel.TextStrokeTransparency = 0 nLabel.Text = p.DisplayName or p.Name nLabel.Parent = gui1 -- distance (at feet) local gui2 = Instance.new("BillboardGui") gui2.Name = "DistESP" gui2.AlwaysOnTop = true gui2.Size = UDim2.fromOffset(75, 12) gui2.StudsOffsetWorldSpace = Vector3.new(0, -3, 0) gui2.Adornee = root gui2.Parent = root local dLabel = Instance.new("TextLabel") dLabel.BackgroundTransparency = 1 dLabel.Size = UDim2.fromScale(1, 1) dLabel.Font = FONT dLabel.TextSize = TEXT_SIZE dLabel.TextColor3 = Color3.new(1, 1, 1) dLabel.TextStrokeTransparency = 0 dLabel.Text = "0 studs" dLabel.Parent = gui2 -- highlight local hl = Instance.new("Highlight") hl.FillTransparency = 1 hl.OutlineTransparency = 0 hl.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop hl.Adornee = char hl.Parent = char esp[p] = { root = root, nLabel = nLabel, dLabel = dLabel, hl = hl, gui1 = gui1, gui2 = gui2, lastDist = -1, lastTeam = p.Team, } applyColor(p, esp[p]) end local function attach(p) if p == LocalPlayer then return end if p.Character then task.spawn(onChar, p, p.Character) end p.CharacterAdded:Connect(function(char) onChar(p, char) end) end Players.PlayerAdded:Connect(attach) for _, p in Players:GetPlayers() do attach(p) end Players.PlayerRemoving:Connect(cleanup) local frame = 0 RunService.Heartbeat:Connect(function() frame += 1 if frame % UPDATE_EVERY ~= 0 then return end local char = LocalPlayer.Character local root = char and char:FindFirstChild("HumanoidRootPart") if not root then return end local pos = root.Position for p, d in esp do if d.root and d.root.Parent then local dist = floor((pos - d.root.Position).Magnitude) if dist ~= d.lastDist then d.lastDist = dist d.dLabel.Text = dist .. " studs" end if p.Team ~= d.lastTeam then d.lastTeam = p.Team applyColor(p, d) end else cleanup(p) end end end)