task.wait(2) local Players = game:GetService("Players") local Workspace = game:GetService("Workspace") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local Camera = workspace.CurrentCamera local LocalPlayer = Players.LocalPlayer local playerGui = LocalPlayer:WaitForChild("PlayerGui") -- Cấu hình local CONFIG = { Enabled = true, MaxDistance = 2000, ShowName = true, ShowDistance = true, BoxESP = true, BoxColor = Color3.fromRGB(0, 255, 0), TextColor = Color3.fromRGB(255, 255, 255), } local espMap = {} local itemsFolder = Workspace:FindFirstChild("Items") local scanThread = nil local renderConn = nil local gui = nil -- Kiểm tra object có phải vật phẩm hợp lệ không local function isValidItem(obj) if not obj or not obj.Parent then return false end if obj:IsA("BasePart") then return true end if obj:IsA("Model") then return obj:FindFirstChildWhichIsA("BasePart") ~= nil end return false end -- Lấy tất cả item hiện tại (đệ quy toàn bộ Items) local function getAllItems() local items = {} if not itemsFolder then return items end local function scan(parent) for _, child in ipairs(parent:GetChildren()) do if isValidItem(child) then table.insert(items, child) end if child:IsA("Model") or child:IsA("Folder") then scan(child) end end end scan(itemsFolder) return items end -- Tạo ESP cho một item local function createESP(item) if espMap[item] then return end local box = Drawing.new("Square") box.Visible = false box.Color = CONFIG.BoxColor box.Thickness = 2 box.Filled = false local text = Drawing.new("Text") text.Visible = false text.Color = CONFIG.TextColor text.Size = 14 text.Center = true text.Outline = true text.OutlineColor = Color3.new(0,0,0) text.Font = 3 espMap[item] = {Box = box, Text = text} end -- Xóa ESP của item local function removeESP(item) local d = espMap[item] if d then d.Box:Remove() d.Text:Remove() espMap[item] = nil end end -- Lấy vị trí của item local function getItemPos(item) if item:IsA("BasePart") then return item.Position elseif item:IsA("Model") then local p = item.PrimaryPart or item:FindFirstChild("HumanoidRootPart") or item:FindFirstChildWhichIsA("BasePart") if p then return p.Position end end return nil end -- Quét toàn bộ và đồng bộ ESP (thêm mới, xóa cũ) local function syncESP() if not itemsFolder then itemsFolder = Workspace:FindFirstChild("Items") if not itemsFolder then return end end local current = getAllItems() -- Xóa những item không còn tồn tại for item, _ in pairs(espMap) do if not item.Parent then removeESP(item) end end -- Thêm item mới for _, item in ipairs(current) do if not espMap[item] then createESP(item) end end end -- Vòng lặp tự động cập nhật danh sách item (mỗi 2 giây) local function autoScanLoop() while true do task.wait(2) syncESP() end end -- Cập nhật ESP mỗi frame (vị trí, hiển thị) local function updateESP() if not CONFIG.Enabled then for _, d in pairs(espMap) do d.Box.Visible = false d.Text.Visible = false end return end local char = LocalPlayer.Character if not char then return end local root = char:FindFirstChild("HumanoidRootPart") if not root then return end local myPos = root.Position for item, d in pairs(espMap) do if not item or not item.Parent then removeESP(item) continue end local pos = getItemPos(item) if not pos then d.Box.Visible = false d.Text.Visible = false continue end local dist = (pos - myPos).Magnitude if dist > CONFIG.MaxDistance then d.Box.Visible = false d.Text.Visible = false continue end local vec, onScreen = Camera:WorldToViewportPoint(pos) if not onScreen then d.Box.Visible = false d.Text.Visible = false continue end if CONFIG.BoxESP then local scale = 80 / (vec.Z * 0.5 + 0.1) local sz = Vector2.new(30 * scale, 30 * scale) d.Box.Position = Vector2.new(vec.X - sz.X/2, vec.Y - sz.Y/2) d.Box.Size = sz d.Box.Visible = true d.Box.Color = CONFIG.BoxColor else d.Box.Visible = false end local txt = item.Name if CONFIG.ShowDistance then txt = txt .. " [" .. math.floor(dist) .. "m]" end d.Text.Text = txt d.Text.Position = Vector2.new(vec.X, vec.Y - 25) d.Text.Visible = CONFIG.ShowName or CONFIG.ShowDistance d.Text.Color = CONFIG.TextColor end end -- Tạo GUI (chỉ có nút ON/OFF) local function createGUI() if gui and gui.Parent then gui:Destroy() end local screenGui = Instance.new("ScreenGui") screenGui.Name = "ItemESP_Auto" screenGui.Parent = playerGui screenGui.ResetOnSpawn = false local frame = Instance.new("Frame") frame.Size = UDim2.new(0, 200, 0, 90) frame.Position = UDim2.new(0.5, -100, 0.5, -45) frame.BackgroundColor3 = Color3.fromRGB(30,30,40) frame.BackgroundTransparency = 0.1 frame.Active = true frame.Draggable = true frame.Parent = screenGui Instance.new("UICorner").CornerRadius = UDim.new(0, 10) local title = Instance.new("TextLabel") title.Size = UDim2.new(1,0,0,25) title.BackgroundColor3 = Color3.fromRGB(0,150,255) title.Text = "📦 Item ESP" title.TextColor3 = Color3.new(1,1,1) title.TextSize = 16 title.Font = Enum.Font.GothamBold title.Parent = frame Instance.new("UICorner").CornerRadius = UDim.new(0, 10) local toggleBtn = Instance.new("TextButton") toggleBtn.Size = UDim2.new(0.7, 0, 0, 35) toggleBtn.Position = UDim2.new(0.15, 0, 0.4, 0) toggleBtn.BackgroundColor3 = CONFIG.Enabled and Color3.fromRGB(0,200,0) or Color3.fromRGB(200,0,0) toggleBtn.Text = CONFIG.Enabled and "ON" or "OFF" toggleBtn.TextColor3 = Color3.new(1,1,1) toggleBtn.TextSize = 18 toggleBtn.Font = Enum.Font.GothamBold toggleBtn.Parent = frame Instance.new("UICorner").CornerRadius = UDim.new(0, 8) toggleBtn.MouseButton1Click:Connect(function() CONFIG.Enabled = not CONFIG.Enabled toggleBtn.Text = CONFIG.Enabled and "ON" or "OFF" toggleBtn.BackgroundColor3 = CONFIG.Enabled and Color3.fromRGB(0,200,0) or Color3.fromRGB(200,0,0) end) local info = Instance.new("TextLabel") info.Size = UDim2.new(1, -10, 0, 15) info.Position = UDim2.new(0, 5, 1, -18) info.BackgroundTransparency = 1 info.Text = "RightShift ẩn/hiện" info.TextColor3 = Color3.fromRGB(150,150,150) info.TextSize = 10 info.Font = Enum.Font.Gotham info.Parent = frame gui = screenGui end -- Phím tắt RightShift UserInputService.InputBegan:Connect(function(i, gp) if gp then return end if i.KeyCode == Enum.KeyCode.RightShift and gui then gui.Enabled = not gui.Enabled end end) -- Khởi tạo task.spawn(function() createGUI() -- Đợi một chút để game load task.wait(1) itemsFolder = Workspace:FindFirstChild("Items") if itemsFolder then print("[ItemESP] Đã tìm thấy Workspace.Items. Đang khởi tạo ESP...") syncESP() -- quét lần đầu scanThread = task.spawn(autoScanLoop) else print("[ItemESP] Không thấy Workspace.Items. Hãy đảm bảo bạn đang ở đúng game.") end renderConn = RunService.RenderStepped:Connect(updateESP) end) print("✅ Item ESP")