local Players = game:GetService("Players") local RunService = game:GetService("RunService") local LocalPlayer = Players.LocalPlayer local Camera = workspace.CurrentCamera -- Cấu hình ESP local Settings = { BoxColor = Color3.fromRGB(0, 255, 255), -- Màu xanh (Người cũ) NewPlayerColor = Color3.fromRGB(255, 215, 0), -- Màu vàng (Người mới) TracerColor = Color3.fromRGB(255, 255, 255), Thickness = 1.5, NewPlayerThreshold = 120 -- 2 phút } local function CreateESP(Player) if Player == LocalPlayer then return end -- Khởi tạo Drawing objects local Box = Drawing.new("Square") Box.Visible = false Box.Thickness = Settings.Thickness Box.Filled = false local Tracer = Drawing.new("Line") Tracer.Visible = false Tracer.Color = Settings.TracerColor Tracer.Thickness = Settings.Thickness -- Lưu thời điểm tham gia local joinTime = os.clock() local function Updater() local connection connection = RunService.RenderStepped:Connect(function() local character = Player.Character if character and character:FindFirstChild("HumanoidRootPart") and character:FindFirstChild("Head") then local rootPart = character.HumanoidRootPart local head = character.Head local pos, onScreen = Camera:WorldToViewportPoint(rootPart.Position) if onScreen then -- Kiểm tra người mới local isNew = (os.clock() - joinTime) < Settings.NewPlayerThreshold -- Tính toán tọa độ Box local headPos = Camera:WorldToViewportPoint(head.Position + Vector3.new(0, 0.5, 0)) local legPos = Camera:WorldToViewportPoint(rootPart.Position - Vector3.new(0, 3, 0)) local height = math.abs(headPos.Y - legPos.Y) local width = height / 1.5 -- Cập nhật Box Box.Size = Vector2.new(width, height) Box.Position = Vector2.new(pos.X - width / 2, pos.Y - height / 2) Box.Color = isNew and Settings.NewPlayerColor or Settings.BoxColor Box.Visible = true -- Cập nhật Tracer (Từ giữa dưới màn hình tới chân Box) Tracer.From = Vector2.new(Camera.ViewportSize.X / 2, Camera.ViewportSize.Y) Tracer.To = Vector2.new(pos.X, pos.Y + (height / 2)) Tracer.Visible = true else Box.Visible = false Tracer.Visible = false end else Box.Visible = false Tracer.Visible = false end -- Dọn dẹp khi người chơi rời đi if not Player.Parent then Box:Remove() Tracer:Remove() connection:Disconnect() end end) end coroutine.wrap(Updater)() end -- Khởi tạo cho người chơi hiện có và người mới vào for _, v in pairs(Players:GetPlayers()) do CreateESP(v) end Players.PlayerAdded:Connect(CreateESP)