--[[ Hp Team Pro V1 - LocalScript Vị trí đặt: StarterPlayer > StarterPlayerScripts Mục đích: công cụ debug/test cho game Roblox do bạn tự xây dựng. ]] --================================================================== -- SECTION 1: SERVICES --================================================================== local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local LocalPlayer = Players.LocalPlayer local PlayerGui = LocalPlayer:WaitForChild("PlayerGui") --================================================================== -- SECTION 2: CONFIG (cần chỉnh khi nối vào game thật) --================================================================== local Config = { Range = 150, -- phạm vi quét (studs) TargetFolder = nil, -- nil = toàn bộ workspace; hoặc workspace.Mobs / workspace.NPCs ExcludePlayers = true, -- bỏ qua mọi nhân vật người chơi AimPart = "HumanoidRootPart", -- bộ phận ngắm (vd "Head") AimSmooth = 1, -- 1 = ghim cứng, 0.1-0.5 = mượt AimMagicHook = nil, -- function(targetModel, aimPos): bắn/gửi hướng bắn tới Server theo điểm ngắm (không cần xoay camera) TeleOffset = Vector3.new(0, 0, 4), -- vị trí đứng so với mục tiêu (trục local của mục tiêu) TeleKillInterval = 0.1, -- chu kỳ Tele Kill (giây) FireInterval = 0.1, -- chu kỳ Auto Bắn (giây) DefaultFlySpeed = 50, DefaultWalkSpeed = 32, AttackHook = nil, -- function(targetModel, aimPos): gọi RemoteEvent/Tool riêng của game -- Ví dụ: Config.AttackHook = function(m, pos) game.ReplicatedStorage.DamageEvent:FireServer(m, pos) end } local COLOR_BG = Color3.fromHex("0C0E0C") local COLOR_PANEL = Color3.fromHex("141814") local COLOR_GREEN = Color3.fromHex("00FF66") --================================================================== -- SECTION 3: STATE & CLEANUP --================================================================== local globalConns = {} local function track(conn) table.insert(globalConns, conn) return conn end local features = {} -- [name] = {on, start, cleanup} local toggleVisuals = {} -- [name] = function(on) local flySpeed = Config.DefaultFlySpeed local walkSpeedValue = Config.DefaultWalkSpeed local flyUp, flyDown = false, false local espFlags = {Line = false, Box = false, Name = false, Distance = false, Hologram = false} local espObjs = {} local espConn = nil local screenGui, espGui, flyPad local isShutdown = false local function setFeature(name, state) local f = features[name] if not f or f.on == state then return end f.on = state if state then f.cleanup = f.start() else if f.cleanup then pcall(f.cleanup) f.cleanup = nil end end if toggleVisuals[name] then toggleVisuals[name](state) end end --================================================================== -- SECTION 4: CHARACTER & TARGET HELPERS --================================================================== local function getChar() return LocalPlayer.Character end local function getHum() local c = getChar() return c and c:FindFirstChildOfClass("Humanoid") end local function getRoot() local c = getChar() return c and c:FindFirstChild("HumanoidRootPart") end -- Registry các Humanoid trong workspace (tránh quét toàn bộ mỗi khung hình) local humanoids = {} local scanRoot = Config.TargetFolder or workspace for _, d in ipairs(scanRoot:GetDescendants()) do if d:IsA("Humanoid") then humanoids[d] = true end end track(scanRoot.DescendantAdded:Connect(function(d) if d:IsA("Humanoid") then humanoids[d] = true end end)) track(scanRoot.DescendantRemoving:Connect(function(d) if d:IsA("Humanoid") then humanoids[d] = nil end end)) local cachedTargets, cachedAt = {}, 0 local function getTargets() local now = os.clock() if now - cachedAt < 0.1 then return cachedTargets end cachedAt = now local list = {} local myRoot, myChar = getRoot(), getChar() if myRoot then for hum in pairs(humanoids) do local m = hum.Parent if m and m:IsA("Model") and m ~= myChar and hum.Health > 0 then if not (Config.ExcludePlayers and Players:GetPlayerFromCharacter(m)) then local r = m.PrimaryPart or m:FindFirstChild("HumanoidRootPart") if r and (r.Position - myRoot.Position).Magnitude <= Config.Range then table.insert(list, m) end end end end end cachedTargets = list return list end local function getNearest() local myRoot = getRoot() if not myRoot then return nil end local best, bestDist for _, m in ipairs(getTargets()) do local r = m.PrimaryPart or m:FindFirstChild("HumanoidRootPart") local hum = m:FindFirstChildOfClass("Humanoid") if r and hum and hum.Health > 0 then local d = (r.Position - myRoot.Position).Magnitude if d <= Config.Range and (not bestDist or d < bestDist) then best, bestDist = {model = m, root = r, dist = d}, d end end end return best end local function getAimPoint(t) local p = t.model:FindFirstChild(Config.AimPart) return (p and p:IsA("BasePart") and p.Position) or t.root.Position end local function attack(target, aimPos) if Config.AttackHook then pcall(Config.AttackHook, target, aimPos) return end local char, hum = getChar(), getHum() if not char or not hum then return end local tool = char:FindFirstChildOfClass("Tool") if not tool then local bp = LocalPlayer:FindFirstChildOfClass("Backpack") local cand = bp and bp:FindFirstChildOfClass("Tool") if cand then hum:EquipTool(cand) tool = cand end end if tool then pcall(function() tool:Activate() end) end end local function aimCameraAt(pos) local cam = workspace.CurrentCamera if not cam then return end local goal = CFrame.lookAt(cam.CFrame.Position, pos) cam.CFrame = cam.CFrame:Lerp(goal, math.clamp(Config.AimSmooth, 0.01, 1)) end --================================================================== -- SECTION 5: ESP (dựng bằng GUI + Highlight) --================================================================== local function newFrame(parent) local f = Instance.new("Frame") f.AnchorPoint = Vector2.new(0.5, 0.5) f.BackgroundColor3 = COLOR_GREEN f.BorderSizePixel = 0 f.Parent = parent return f end local function ensure(obj, key, enabled, factory) if enabled then if not obj[key] then obj[key] = factory() end elseif obj[key] then obj[key]:Destroy() obj[key] = nil end return obj[key] end local function destroyEsp(m) local obj = espObjs[m] if not obj then return end for _, inst in pairs(obj) do if typeof(inst) == "Instance" then inst:Destroy() end end espObjs[m] = nil end local function clearAllEsp() for m in pairs(espObjs) do destroyEsp(m) end end local function updateEsp() local cam = workspace.CurrentCamera local myRoot = getRoot() if not cam or not myRoot or not espGui then return end local viewport = cam.ViewportSize local alive = {} for _, m in ipairs(getTargets()) do alive[m] = true local root = m.PrimaryPart or m:FindFirstChild("HumanoidRootPart") if root then local obj = espObjs[m] if not obj then obj = {} espObjs[m] = obj end -- Hologram (xuyên tường) local hl = ensure(obj, "hl", espFlags.Hologram, function() local h = Instance.new("Highlight") h.Adornee = m h.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop h.FillColor = COLOR_GREEN h.FillTransparency = 0.6 h.OutlineColor = COLOR_GREEN h.Parent = m return h end) if hl then hl.Enabled = true end -- Tính vùng chiếu màn hình local needBounds = espFlags.Box or espFlags.Name or espFlags.Distance local visible, minX, minY, maxX, maxY = true, math.huge, math.huge, -math.huge, -math.huge if needBounds then local cf, size = m:GetBoundingBox() for ix = -1, 1, 2 do for iy = -1, 1, 2 do for iz = -1, 1, 2 do local v = cam:WorldToViewportPoint(cf * Vector3.new(ix * size.X / 2, iy * size.Y / 2, iz * size.Z / 2)) if v.Z <= 0 then visible = false end minX, minY = math.min(minX, v.X), math.min(minY, v.Y) maxX, maxY = math.max(maxX, v.X), math.max(maxY, v.Y) end end end end local rv = cam:WorldToViewportPoint(root.Position) local rootVisible = rv.Z > 0 -- Line local line = ensure(obj, "line", espFlags.Line, function() return newFrame(espGui) end) if line then line.Visible = rootVisible if rootVisible then local p1 = Vector2.new(viewport.X / 2, 0) local p2 = Vector2.new(rv.X, rv.Y) local delta = p2 - p1 local mid = (p1 + p2) / 2 line.Position = UDim2.fromOffset(mid.X, mid.Y) line.Size = UDim2.fromOffset(delta.Magnitude, 1.5) line.Rotation = math.deg(math.atan2(delta.Y, delta.X)) end end -- Box local box = ensure(obj, "box", espFlags.Box, function() local f = Instance.new("Frame") f.BackgroundTransparency = 1 f.BorderSizePixel = 0 local s = Instance.new("UIStroke") s.Color = COLOR_GREEN s.Thickness = 1.5 s.Parent = f f.Parent = espGui return f end) if box then box.Visible = visible if visible then box.Position = UDim2.fromOffset(minX, minY) box.Size = UDim2.fromOffset(maxX - minX, maxY - minY) end end -- Name + Distance local label = ensure(obj, "label", espFlags.Name or espFlags.Distance, function() local t = Instance.new("TextLabel") t.AnchorPoint = Vector2.new(0.5, 1) t.BackgroundTransparency = 1 t.TextColor3 = COLOR_GREEN t.TextStrokeTransparency = 0 t.Font = Enum.Font.GothamBold t.TextSize = 13 t.Size = UDim2.fromOffset(160, 14) t.Parent = espGui return t end) if label then label.Visible = visible if visible then local text = "" if espFlags.Name then text = m.Name end if espFlags.Distance then local d = math.floor((root.Position - myRoot.Position).Magnitude) text = text .. (text ~= "" and " " or "") .. "[" .. d .. "m]" end label.Text = text label.Position = UDim2.fromOffset((minX + maxX) / 2, minY - 2) end end end end for m in pairs(espObjs) do if not alive[m] then destroyEsp(m) end end end local function refreshEsp() local any = false for _, v in pairs(espFlags) do if v then any = true end end if any then if not espConn then espConn = RunService.RenderStepped:Connect(updateEsp) end else if espConn then espConn:Disconnect() espConn = nil end clearAllEsp() end end --================================================================== -- SECTION 6: FEATURES --================================================================== local function defineFeature(name, startFn) features[name] = {on = false, start = startFn, cleanup = nil} end -- 6.1 MAIN --------------------------------------------------------- defineFeature("TeleKill", function() local acc = 0 local c = RunService.Heartbeat:Connect(function(dt) acc += dt if acc < Config.TeleKillInterval then return end acc = 0 local root = getRoot() local t = getNearest() if not root or not t then return end local pos = (t.root.CFrame * CFrame.new(Config.TeleOffset)).Position root.CFrame = CFrame.lookAt(pos, Vector3.new(t.root.Position.X, pos.Y, t.root.Position.Z)) root.AssemblyLinearVelocity = Vector3.zero attack(t.model) end) return function() c:Disconnect() end end) defineFeature("Aimbot", function() local id = "HpTeamPro_Aimbot" RunService:BindToRenderStep(id, Enum.RenderPriority.Camera.Value + 1, function() local t = getNearest() if t then aimCameraAt(getAimPoint(t)) end end) return function() RunService:UnbindFromRenderStep(id) end end) defineFeature("AimMagic", function() -- Không khóa màn hình, không khóa mục tiêu: -- mỗi lần bấm bắn chọn mục tiêu gần nhất tại thời điểm đó, hướng camera tới nó vài khung hình -- rồi trả hướng camera về như cũ. Game bắn bằng Remote thì dùng Config.AimMagicHook. local id = "HpTeamPro_AimMagic" local pending = nil -- {stage, rotation, aimPos} local function isFire(i) return i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch end local c1 = UserInputService.InputBegan:Connect(function(i) if not isFire(i) or pending then return end local cam = workspace.CurrentCamera local t = getNearest() if not cam or not t then return end local aimPos = getAimPoint(t) if Config.AimMagicHook then pcall(Config.AimMagicHook, t.model, aimPos) end pending = {stage = 0, rotation = cam.CFrame - cam.CFrame.Position, aimPos = aimPos} end) RunService:BindToRenderStep(id, Enum.RenderPriority.Camera.Value + 1, function() if not pending then return end local cam = workspace.CurrentCamera if not cam then pending = nil return end if pending.stage == 0 then cam.CFrame = CFrame.lookAt(cam.CFrame.Position, pending.aimPos) pending.stage = 1 elseif pending.stage == 1 then cam.CFrame = CFrame.lookAt(cam.CFrame.Position, pending.aimPos) pending.stage = 2 else cam.CFrame = CFrame.new(cam.CFrame.Position) * pending.rotation pending = nil end end) return function() c1:Disconnect() RunService:UnbindFromRenderStep(id) pending = nil end end) defineFeature("AutoFire", function() local acc = 0 local c = RunService.Heartbeat:Connect(function(dt) acc += dt if acc < Config.FireInterval then return end acc = 0 local t = getNearest() -- chọn lại mục tiêu mỗi nhịp, không khóa mục tiêu, không đụng Camera if t then attack(t.model, getAimPoint(t)) end end) return function() c:Disconnect() end end) -- 6.2 ESP ---------------------------------------------------------- local function espFeature(name, flag) defineFeature(name, function() espFlags[flag] = true refreshEsp() return function() espFlags[flag] = false refreshEsp() end end) end espFeature("EspLine", "Line") espFeature("EspBox", "Box") espFeature("EspName", "Name") espFeature("EspDistance", "Distance") espFeature("EspHologram", "Hologram") -- 6.3 KHÁC --------------------------------------------------------- defineFeature("NoClip", function() local touched = {} local c = RunService.Stepped:Connect(function() local char = getChar() if not char then return end for _, p in ipairs(char:GetDescendants()) do if p:IsA("BasePart") and p.CanCollide then if touched[p] == nil then touched[p] = true end p.CanCollide = false end end end) return function() c:Disconnect() for p in pairs(touched) do if p.Parent then p.CanCollide = true end end end end) defineFeature("FlyAir", function() -- LinearVelocity với lực vô hạn: vận tốc = 0 khi không bấm => đứng yên giữa không trung, không tự rơi. if flyPad then flyPad.Visible = true end local att, lv, lastRoot local function destroyMovers() if lv then lv:Destroy() lv = nil end if att then att:Destroy() att = nil end lastRoot = nil end local function build(root) destroyMovers() att = Instance.new("Attachment") att.Name = "HpFlyAttachment" att.Parent = root lv = Instance.new("LinearVelocity") lv.Name = "HpFlyVelocity" lv.Attachment0 = att lv.RelativeTo = Enum.ActuatorRelativeTo.World lv.VelocityConstraintMode = Enum.VelocityConstraintMode.Vector lv.MaxForce = math.huge lv.VectorVelocity = Vector3.zero lv.Parent = root lastRoot = root end local c = RunService.Heartbeat:Connect(function() local root, hum = getRoot(), getHum() if not root or not hum then return end if lastRoot ~= root or not lv or lv.Parent ~= root then build(root) end local vy = (flyUp and 1 or 0) - (flyDown and 1 or 0) lv.VectorVelocity = hum.MoveDirection * flySpeed + Vector3.new(0, vy * flySpeed, 0) end) return function() c:Disconnect() destroyMovers() flyUp, flyDown = false, false if flyPad then flyPad.Visible = false end end end) defineFeature("Speed", function() local hum0 = getHum() local original = hum0 and hum0.WalkSpeed or 16 local c = RunService.Heartbeat:Connect(function() local hum = getHum() if hum then hum.WalkSpeed = walkSpeedValue end end) return function() c:Disconnect() local hum = getHum() if hum then hum.WalkSpeed = original end end end) defineFeature("JumpAir", function() local c = UserInputService.JumpRequest:Connect(function() local hum = getHum() if hum then hum:ChangeState(Enum.HumanoidStateType.Jumping) end end) return function() c:Disconnect() end end) --================================================================== -- SECTION 7: GUI --================================================================== local function shutdown() if isShutdown then return end isShutdown = true for name in pairs(features) do setFeature(name, false) end if espConn then espConn:Disconnect() espConn = nil end clearAllEsp() for _, c in ipairs(globalConns) do if c.Connected then c:Disconnect() end end table.clear(globalConns) if espGui then espGui:Destroy() end if screenGui then screenGui:Destroy() end end local function addStroke(inst, thickness, color) local s = Instance.new("UIStroke") s.Color = color or COLOR_GREEN s.Thickness = thickness or 1 s.Parent = inst return s end local function makeButton(parent, text, size, pos) local b = Instance.new("TextButton") b.Text = text b.Size = size b.Position = pos or UDim2.new() b.BackgroundColor3 = COLOR_PANEL b.TextColor3 = COLOR_GREEN b.Font = Enum.Font.GothamBold b.TextSize = 13 b.AutoButtonColor = true b.BorderSizePixel = 0 b.Parent = parent return b end -- Lớp vẽ ESP espGui = Instance.new("ScreenGui") espGui.Name = "HpTeamProEsp" espGui.ResetOnSpawn = false espGui.IgnoreGuiInset = true espGui.DisplayOrder = 5 espGui.Parent = PlayerGui -- Menu chính screenGui = Instance.new("ScreenGui") screenGui.Name = "HpTeamProV1" screenGui.ResetOnSpawn = false screenGui.DisplayOrder = 10 screenGui.Parent = PlayerGui local MENU_W, MENU_H, TITLE_H = 350, 200, 26 local main = Instance.new("Frame") main.Name = "Main" main.Size = UDim2.fromOffset(MENU_W, MENU_H) main.Position = UDim2.new(0.5, -MENU_W / 2, 0.5, -MENU_H / 2) main.BackgroundColor3 = COLOR_BG main.BorderSizePixel = 0 main.ClipsDescendants = true main.Parent = screenGui addStroke(main, 1.5) -- Thanh tiêu đề local titleBar = Instance.new("Frame") titleBar.Size = UDim2.new(1, 0, 0, TITLE_H) titleBar.BackgroundColor3 = COLOR_PANEL titleBar.BorderSizePixel = 0 titleBar.Parent = main local titleLabel = Instance.new("TextLabel") titleLabel.Text = "Hp Team Pro V1" titleLabel.Size = UDim2.new(1, -64, 1, 0) titleLabel.Position = UDim2.fromOffset(8, 0) titleLabel.BackgroundTransparency = 1 titleLabel.TextColor3 = COLOR_GREEN titleLabel.Font = Enum.Font.GothamBold titleLabel.TextSize = 14 titleLabel.TextXAlignment = Enum.TextXAlignment.Left titleLabel.Parent = titleBar local minBtn = makeButton(titleBar, "-", UDim2.fromOffset(26, 20), UDim2.new(1, -58, 0, 3)) local closeBtn = makeButton(titleBar, "X", UDim2.fromOffset(26, 20), UDim2.new(1, -29, 0, 3)) -- Tab bar local tabBar = Instance.new("Frame") tabBar.Size = UDim2.new(1, -8, 0, 22) tabBar.Position = UDim2.fromOffset(4, TITLE_H + 2) tabBar.BackgroundTransparency = 1 tabBar.Parent = main local tabLayout = Instance.new("UIListLayout") tabLayout.FillDirection = Enum.FillDirection.Horizontal tabLayout.Padding = UDim.new(0, 4) tabLayout.Parent = tabBar local tabNames = {"Main", "Esp", "Khác"} local tabButtons, pages = {}, {} local PAGE_TOP = TITLE_H + 28 for _, name in ipairs(tabNames) do local b = makeButton(tabBar, name, UDim2.new(1 / 3, -3, 1, 0)) tabButtons[name] = b local page = Instance.new("ScrollingFrame") page.Size = UDim2.new(1, -8, 1, -(PAGE_TOP + 4)) page.Position = UDim2.fromOffset(4, PAGE_TOP) page.BackgroundColor3 = COLOR_PANEL page.BorderSizePixel = 0 page.ScrollBarThickness = 4 page.ScrollBarImageColor3 = COLOR_GREEN page.ScrollingEnabled = true page.ScrollingDirection = Enum.ScrollingDirection.Y page.CanvasSize = UDim2.new() page.AutomaticCanvasSize = Enum.AutomaticSize.Y page.Visible = false page.Parent = main local lay = Instance.new("UIListLayout") lay.Padding = UDim.new(0, 4) lay.Parent = page local pad = Instance.new("UIPadding") pad.PaddingTop, pad.PaddingLeft, pad.PaddingRight, pad.PaddingBottom = UDim.new(0, 4), UDim.new(0, 4), UDim.new(0, 6), UDim.new(0, 4) pad.Parent = page pages[name] = page end local function selectTab(name) for _, n in ipairs(tabNames) do local active = n == name pages[n].Visible = active tabButtons[n].BackgroundColor3 = active and COLOR_GREEN or COLOR_PANEL tabButtons[n].TextColor3 = active and COLOR_BG or COLOR_GREEN end end for _, n in ipairs(tabNames) do track(tabButtons[n].Activated:Connect(function() selectTab(n) end)) end -- Hàng chức năng (toggle + ô nhập số tuỳ chọn) local function makeRow(pageName, label, featureName, inputDefault, onValue) local row = Instance.new("Frame") row.Size = UDim2.new(1, 0, 0, 30) row.BackgroundColor3 = COLOR_BG row.BorderSizePixel = 0 row.Parent = pages[pageName] addStroke(row, 1, Color3.fromHex("0A7A35")) local hasInput = inputDefault ~= nil local btn = makeButton(row, label, UDim2.new(1, hasInput and -66 or 0, 1, 0)) btn.BackgroundColor3 = COLOR_BG toggleVisuals[featureName] = function(on) btn.BackgroundColor3 = on and COLOR_GREEN or COLOR_BG btn.TextColor3 = on and COLOR_BG or COLOR_GREEN end track(btn.Activated:Connect(function() setFeature(featureName, not features[featureName].on) end)) if hasInput then local box = Instance.new("TextBox") box.Size = UDim2.new(0, 58, 1, -6) box.Position = UDim2.new(1, -62, 0, 3) box.BackgroundColor3 = COLOR_PANEL box.TextColor3 = COLOR_GREEN box.Font = Enum.Font.Gotham box.TextSize = 13 box.Text = tostring(inputDefault) box.ClearTextOnFocus = false box.BorderSizePixel = 0 box.Parent = row addStroke(box, 1) track(box.FocusLost:Connect(function() local n = tonumber(box.Text) if n then n = math.clamp(n, 1, 500) box.Text = tostring(n) onValue(n) else box.Text = tostring(inputDefault) end end)) end end -- Tab Main makeRow("Main", "Tele Kill", "TeleKill") makeRow("Main", "Aimbot", "Aimbot") makeRow("Main", "Aim Magic", "AimMagic") makeRow("Main", "Auto Bắn", "AutoFire") -- Tab Esp makeRow("Esp", "Esp Line", "EspLine") makeRow("Esp", "Esp Box", "EspBox") makeRow("Esp", "Esp Name", "EspName") makeRow("Esp", "Esp Distance", "EspDistance") makeRow("Esp", "Esp Hologram", "EspHologram") -- Tab Khác makeRow("Khác", "No Clip", "NoClip") makeRow("Khác", "Fly Air", "FlyAir", Config.DefaultFlySpeed, function(n) flySpeed = n end) makeRow("Khác", "Speed", "Speed", Config.DefaultWalkSpeed, function(n) walkSpeedValue = n end) makeRow("Khác", "Jumping Air", "JumpAir") -- Nút tăng/giảm độ cao khi bay flyPad = Instance.new("Frame") flyPad.Name = "FlyPad" flyPad.Size = UDim2.fromOffset(60, 124) flyPad.Position = UDim2.new(1, -76, 0.5, -62) flyPad.BackgroundTransparency = 1 flyPad.Visible = false flyPad.Parent = screenGui local upBtn = makeButton(flyPad, "▲", UDim2.fromOffset(60, 58), UDim2.fromOffset(0, 0)) local downBtn = makeButton(flyPad, "▼", UDim2.fromOffset(60, 58), UDim2.fromOffset(0, 66)) for _, b in ipairs({upBtn, downBtn}) do b.BackgroundColor3 = COLOR_BG b.TextSize = 24 addStroke(b, 1.5) end track(upBtn.MouseButton1Down:Connect(function() flyUp = true end)) track(upBtn.MouseButton1Up:Connect(function() flyUp = false end)) track(upBtn.MouseLeave:Connect(function() flyUp = false end)) track(downBtn.MouseButton1Down:Connect(function() flyDown = true end)) track(downBtn.MouseButton1Up:Connect(function() flyDown = false end)) track(downBtn.MouseLeave:Connect(function() flyDown = false end)) -- Thu nhỏ / Thoát local minimized = false track(minBtn.Activated:Connect(function() minimized = not minimized minBtn.Text = minimized and "+" or "-" tabBar.Visible = not minimized for _, n in ipairs(tabNames) do pages[n].Visible = not minimized and tabButtons[n].BackgroundColor3 == COLOR_GREEN end main.Size = UDim2.fromOffset(MENU_W, minimized and TITLE_H or MENU_H) end)) track(closeBtn.Activated:Connect(shutdown)) -- Kéo thả (chuột + cảm ứng) do local dragging, dragStart, startPos = false, nil, nil track(titleBar.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragStart = input.Position startPos = main.Position local endConn endConn = input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false endConn:Disconnect() end end) end end)) track(UserInputService.InputChanged:Connect(function(input) if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then local d = input.Position - dragStart main.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + d.X, startPos.Y.Scale, startPos.Y.Offset + d.Y) end end)) end selectTab("Main")