--[[ ControlMenu.lua (LocalScript -> StarterPlayerScripts) Modules: StateManager, TargetScanner, CombatEngine, EspEngine, MovementAndWorld, UIController Chỉ dùng trong game của bạn / môi trường test. ]] local Players = game:GetService("Players") local RunService= game:GetService("RunService") local UIS = game:GetService("UserInputService") local Workspace = game:GetService("Workspace") local Lighting = game:GetService("Lighting") local LP = Players.LocalPlayer -- Chạy lại script thì dọn bản cũ trước if _G.__ControlMenuShutdown then pcall(_G.__ControlMenuShutdown) end ------------------------------------------------------------------ Maid -- Gom connection/Instance/function để dọn một lần, tránh rò rỉ khi bật/tắt nhiều lần local Maid = {} Maid.__index = Maid function Maid.new() return setmetatable({ tasks = {} }, Maid) end function Maid:Add(t) table.insert(self.tasks, t) return t end function Maid:Clean() local list = self.tasks self.tasks = {} for _, t in ipairs(list) do local ty = typeof(t) if ty == "RBXScriptConnection" then t:Disconnect() elseif ty == "Instance" then pcall(game.Destroy, t) elseif ty == "function" then pcall(t) end end end local function getChar() local c = LP.Character return c, c and c:FindFirstChildOfClass("Humanoid"), c and c:FindFirstChild("HumanoidRootPart") end local RootMaid = Maid.new() ------------------------------------------------------------------ StateManager local State = { Config = { ScanRange = 150, SafeHeight = 15, KillDistance = 4, FlySpeed = 50, WalkSpeed = 40, DroneRate = 6, AimSmooth = 0.25, ScanInterval = 0.1, AttackInterval = 0.15, }, Flags = {}, Snapshots = {}, Changed = Instance.new("BindableEvent"), _binds = {}, -- Các nhóm loại trừ nhau: bật cái này thì tắt cái kia _groups = { { "TeleDron", "TeleKill" }, { "FlyAir", "FlyDown", "FlyDron" } }, } function State:Bind(flag, fn) self._binds[flag] = self._binds[flag] or {} table.insert(self._binds[flag], fn) end function State:_fire(flag, on) for _, fn in ipairs(self._binds[flag] or {}) do local ok, err = pcall(fn, on) if not ok then warn("[Menu]", flag, err) end end end function State:Set(flag, on) on = on and true or false if (self.Flags[flag] or false) == on then return end if on then for _, g in ipairs(self._groups) do if table.find(g, flag) then for _, o in ipairs(g) do if o ~= flag and self.Flags[o] then self:Set(o, false) end end end end end self.Flags[flag] = on self:_fire(flag, on) self.Changed:Fire(flag, on) end function State:Refire(flag) -- dùng khi respawn if self.Flags[flag] then self:_fire(flag, false) self:_fire(flag, true) end end -- Snapshot: chỉ lưu lần đầu, Restore trả lại rồi xoá function State:Snap(key, getter) if self.Snapshots[key] == nil then self.Snapshots[key] = { v = getter() } end end function State:Restore(key, setter) local s = self.Snapshots[key] if s then self.Snapshots[key] = nil pcall(setter, s.v) end end ------------------------------------------------------------------ TargetScanner local Scanner = { Targets = {}, Lookup = {}, _hums = {}, _acc = 0 } -- Đổi hàm này để ưu tiên "khả năng tiếp cận" (vd: cộng điểm nếu bị vật cản chắn) Scanner.Score = function(e) return e.Distance end local function trackHum(d) if d:IsA("Humanoid") then Scanner._hums[d] = true end end RootMaid:Add(Workspace.DescendantAdded:Connect(trackHum)) RootMaid:Add(Workspace.DescendantRemoving:Connect(function(d) Scanner._hums[d] = nil end)) for _, d in ipairs(Workspace:GetDescendants()) do trackHum(d) end -- cache Humanoid một lần, không quét workspace mỗi lần function Scanner:_need() local F = State.Flags return F.TeleDron or F.TeleKill or F.Aimbot or F.EspLine or F.EspBox or F.EspName or F.EspDistance or F.EspHologram end function Scanner:Scan() table.clear(self.Targets) table.clear(self.Lookup) local myChar, _, myRoot = getChar() if not myRoot then return end local range = State.Config.ScanRange for hum in pairs(self._hums) do local m = hum.Parent if m and m:IsA("Model") and m ~= myChar and hum.Health > 0 and not Players:GetPlayerFromCharacter(m) then -- loại người chơi local root = m:FindFirstChild("HumanoidRootPart") or m.PrimaryPart if root and root:IsA("BasePart") then local d = (root.Position - myRoot.Position).Magnitude if d <= range then local e = { Model = m, Humanoid = hum, Root = root, Distance = d } self.Lookup[m] = e table.insert(self.Targets, e) end end end end table.sort(self.Targets, function(a, b) return Scanner.Score(a) < Scanner.Score(b) end) end RootMaid:Add(RunService.Heartbeat:Connect(function(dt) if not Scanner:_need() then if #Scanner.Targets > 0 then table.clear(Scanner.Targets) table.clear(Scanner.Lookup) end return end Scanner._acc += dt if Scanner._acc >= State.Config.ScanInterval then -- quét theo chu kỳ, không quét mỗi khung hình Scanner._acc = 0 Scanner:Scan() end end)) ------------------------------------------------------------------ CombatEngine local Combat = { Target = nil, _tele = nil } -- >>> CẮM CƠ CHẾ TẤN CÔNG CỦA GAME VÀO ĐÂY <<< -- target = { Model, Humanoid, Root, Distance }, mode = "Drone" | "Kill" -- Ví dụ remote: game.ReplicatedStorage.Remotes.Attack:FireServer(target.Model) -- Ví dụ skill: game.ReplicatedStorage.Remotes.Skill:FireServer("Skill1", target.Root.Position) -- Mặc định: kích hoạt Tool đang cầm. Combat.AttackHook = function(target, mode) local c = LP.Character local tool = c and c:FindFirstChildOfClass("Tool") if tool then tool:Activate() end end -- Khoá mục tiêu: giữ mục tiêu cũ tới khi chết / biến mất / ra ngoài 150, rồi tự chuyển sang mục tiêu gần nhất function Combat:Acquire() local t = self.Target if t then local e = Scanner.Lookup[t.Model] if e and e.Humanoid.Health > 0 and e.Root.Parent then self.Target = e return e end end self.Target = Scanner.Targets[1] return self.Target end function Combat:_stopTele() if self._tele then self._tele:Clean() self._tele = nil end end function Combat:_startTele(mode) self:_stopTele() local m = Maid.new() self._tele = m local last = 0 m:Add(RunService.Heartbeat:Connect(function() local _, hum, root = getChar() if not root or not hum or hum.Health <= 0 then return end local t = Combat:Acquire() if not t then return end local tp = t.Root.Position local cf if mode == "Drone" then -- Lơ lửng phía trên mục tiêu, né tầm cận chiến local pos = tp + Vector3.new(0, State.Config.SafeHeight, 0) cf = CFrame.lookAt(pos, Vector3.new(tp.X, pos.Y, tp.Z)) else -- Đứng sau lưng mục tiêu local p = (t.Root.CFrame * CFrame.new(0, 0, State.Config.KillDistance)).Position cf = CFrame.lookAt(p, Vector3.new(tp.X, p.Y, tp.Z)) end root.CFrame = cf root.AssemblyLinearVelocity = Vector3.zero -- triệt tiêu lực rơi/đẩy lùi root.AssemblyAngularVelocity = Vector3.zero local now = os.clock() if now - last >= State.Config.AttackInterval then last = now local ok, err = pcall(Combat.AttackHook, t, mode) if not ok then warn("[AttackHook]", err) end end end)) end State:Bind("TeleDron", function(on) if on then Combat:_startTele("Drone") else Combat:_stopTele() end end) State:Bind("TeleKill", function(on) if on then Combat:_startTele("Kill") else Combat:_stopTele() end end) State:Bind("Aimbot", function(on) pcall(RunService.UnbindFromRenderStep, RunService, "MenuAimbot") if not on then return end RunService:BindToRenderStep("MenuAimbot", Enum.RenderPriority.Camera.Value + 1, function() local cam = Workspace.CurrentCamera local t = Combat:Acquire() if not cam or not t then return end local aim = t.Model:FindFirstChild("Head") or t.Root local cur = cam.CFrame local goal = CFrame.lookAt(cur.Position, aim.Position) if cur.LookVector:Dot(goal.LookVector) > 0.99995 then return end -- chống rung khi đã trúng tâm cam.CFrame = cur:Lerp(goal, State.Config.AimSmooth) -- lerp = mượt khi đổi mục tiêu end) end) ------------------------------------------------------------------ EspEngine local RED, YELLOW = Color3.fromRGB(255, 70, 70), Color3.fromRGB(255, 220, 0) local Esp = { _entries = {}, _hl = {}, _items = {}, _acc = 0, _conn = nil, gui = nil } local function tcount(t) local n = 0 for _ in pairs(t) do n += 1 end return n end local function mkHL(adornee, color) local h = Instance.new("Highlight") h.Name = "EspHL" h.Adornee = adornee h.FillColor = color h.OutlineColor = color h.FillTransparency = 0.6 h.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop -- xuyên tường h.Parent = adornee -- bị huỷ theo adornee khi mob/vật phẩm biến mất return h end function Esp:_slots() return 30 - tcount(self._hl) - tcount(self._items) end -- giới hạn 31 Highlight của Roblox local function mkLabel(parent) local l = Instance.new("TextLabel") l.BackgroundTransparency = 1 l.TextColor3 = Color3.new(1, 1, 1) l.TextStrokeTransparency = 0 l.Font = Enum.Font.GothamBold l.TextSize = 13 l.AnchorPoint = Vector2.new(0.5, 0) l.Size = UDim2.fromOffset(200, 14) l.Parent = parent return l end function Esp:_ensureGui() if self.gui and self.gui.Parent then return end local g = Instance.new("ScreenGui") g.Name = "EspGui" g.ResetOnSpawn = false g.IgnoreGuiInset = true g.DisplayOrder = 50 g.Parent = LP:WaitForChild("PlayerGui") self.gui = g end function Esp:_new(model) self:_ensureGui() local f = Instance.new("Folder") f.Parent = self.gui local line = Instance.new("Frame") line.AnchorPoint = Vector2.new(0.5, 0.5) line.BorderSizePixel = 0 line.BackgroundColor3 = RED line.Parent = f local box = Instance.new("Frame") box.BackgroundTransparency = 1 box.BorderSizePixel = 0 box.Parent = f local st = Instance.new("UIStroke") st.Color = RED st.Thickness = 1.5 st.Parent = box local ent = { folder = f, line = line, box = box, name = mkLabel(f), dist = mkLabel(f) } self._entries[model] = ent return ent end function Esp:_draw(ent, e, cam, vp, myRoot) local F = State.Flags local cf, size = e.Model:GetBoundingBox() local minX, minY, maxX, maxY = math.huge, math.huge, -math.huge, -math.huge local visible = true -- World-to-Screen 8 góc bounding box 3D -> khung 2D for ix = -1, 1, 2 do for iy = -1, 1, 2 do for iz = -1, 1, 2 do local p = cam:WorldToViewportPoint(cf:PointToWorldSpace( Vector3.new(size.X / 2 * ix, size.Y / 2 * iy, size.Z / 2 * iz))) if p.Z <= 0 then visible = false end minX = math.min(minX, p.X) maxX = math.max(maxX, p.X) minY = math.min(minY, p.Y) maxY = math.max(maxY, p.Y) end end end local c = cam:WorldToViewportPoint(cf.Position) if c.Z <= 0 then visible = false end ent.line.Visible = visible and F.EspLine or false ent.box.Visible = visible and F.EspBox or false ent.name.Visible = visible and F.EspName or false ent.dist.Visible = visible and F.EspDistance or false if not visible then return end if ent.line.Visible then local x0, y0, x1, y1 = vp.X / 2, 0, c.X, c.Y -- từ cạnh trên giữa màn hình local dx, dy = x1 - x0, y1 - y0 ent.line.Size = UDim2.fromOffset(math.sqrt(dx * dx + dy * dy), 1.5) ent.line.Position = UDim2.fromOffset((x0 + x1) / 2, (y0 + y1) / 2) ent.line.Rotation = math.deg(math.atan2(dy, dx)) end if ent.box.Visible then ent.box.Position = UDim2.fromOffset(minX, minY) ent.box.Size = UDim2.fromOffset(maxX - minX, maxY - minY) end if ent.name.Visible then ent.name.Text = e.Model.Name ent.name.Position = UDim2.fromOffset((minX + maxX) / 2, minY - 16) end if ent.dist.Visible then local d = myRoot and (e.Root.Position - myRoot.Position).Magnitude or e.Distance ent.dist.Text = string.format("%d studs (%.0fm)", d, d * 0.28) ent.dist.Position = UDim2.fromOffset((minX + maxX) / 2, maxY + 2) end end function Esp:_scanItems() local folder = Workspace:FindFirstChild("Item") -- kiểm tra tồn tại trước khi truy cập local seen = {} local _, _, myRoot = getChar() if folder and myRoot then local function visit(inst) for _, c in ipairs(inst:GetChildren()) do if c:IsA("Folder") then visit(c) elseif c:IsA("Model") or c:IsA("BasePart") then local ok, pos = pcall(function() return c:GetPivot().Position end) if ok and (pos - myRoot.Position).Magnitude <= State.Config.ScanRange then seen[c] = true if not self._items[c] and self:_slots() > 0 then self._items[c] = mkHL(c, YELLOW) end end end end end visit(folder) end for c, h in pairs(self._items) do if not seen[c] or not c.Parent then pcall(game.Destroy, h) self._items[c] = nil end end end function Esp:_step(dt) local F = State.Flags local cam = Workspace.CurrentCamera if not cam then return end local vp = cam.ViewportSize local _, _, myRoot = getChar() local drawing = F.EspLine or F.EspBox or F.EspName or F.EspDistance local alive = {} for _, e in ipairs(Scanner.Targets) do if e.Humanoid.Health > 0 and e.Root.Parent then alive[e.Model] = true if drawing then self:_draw(self._entries[e.Model] or self:_new(e.Model), e, cam, vp, myRoot) end if F.EspHologram and not self._hl[e.Model] and self:_slots() > 0 then self._hl[e.Model] = mkHL(e.Model, RED) end end end -- Mob chết / ra khỏi 150 / bị huỷ -> xoá esp ngay for m, ent in pairs(self._entries) do if not alive[m] or not drawing then ent.folder:Destroy() self._entries[m] = nil end end for m, h in pairs(self._hl) do if not alive[m] or not F.EspHologram or not m.Parent then pcall(game.Destroy, h) self._hl[m] = nil end end if F.EspWorkspace then self._acc += dt if self._acc >= 0.5 then self._acc = 0 self:_scanItems() end end end function Esp:Cleanup() if self._conn then self._conn:Disconnect() self._conn = nil end for m, ent in pairs(self._entries) do pcall(game.Destroy, ent.folder) self._entries[m] = nil end for m, h in pairs(self._hl) do pcall(game.Destroy, h) self._hl[m] = nil end for c, h in pairs(self._items) do pcall(game.Destroy, h) self._items[c] = nil end if self.gui then self.gui:Destroy() self.gui = nil end end function Esp:Sync() local F = State.Flags local drawing = F.EspLine or F.EspBox or F.EspName or F.EspDistance if not (drawing or F.EspHologram or F.EspWorkspace) then return self:Cleanup() end if not self._conn then self._conn = RunService.RenderStepped:Connect(function(dt) Esp:_step(dt) end) end if not F.EspWorkspace then for c, h in pairs(self._items) do pcall(game.Destroy, h) self._items[c] = nil end end end for _, f in ipairs({ "EspLine", "EspBox", "EspName", "EspDistance", "EspHologram", "EspWorkspace" }) do State:Bind(f, function() Esp:Sync() end) end ------------------------------------------------------------------ MovementAndWorld -- ===== NoClip (dùng chung cho flag NoClip và Fly Down) ===== local NoClip = { users = {}, snap = setmetatable({}, { __mode = "k" }), conn = nil } function NoClip:SetUser(name, on) self.users[name] = on or nil if next(self.users) then if self.conn then return end self.conn = RunService.Stepped:Connect(function() local c = LP.Character if not c then return end for _, p in ipairs(c:GetDescendants()) do if p:IsA("BasePart") then if self.snap[p] == nil then self.snap[p] = p.CanCollide end -- lưu giá trị gốc p.CanCollide = false end end end) elseif self.conn then self.conn:Disconnect() self.conn = nil for p, v in pairs(self.snap) do if p.Parent then p.CanCollide = v end end table.clear(self.snap) end end State:Bind("NoClip", function(on) NoClip:SetUser("Flag", on) end) -- ===== Flight: air (đứng thẳng) / down (nằm ngửa, xuyên đất) / dron (úp mặt, độ cao cố định) ===== local Flight = { mode = nil, maid = nil, Vertical = 0, _root = nil, _flat = Vector3.new(0, 0, -1) } local function orient(look, up) return CFrame.fromMatrix(Vector3.zero, look:Cross(up), up, -look) end function Flight:Stop() if self.maid then self.maid:Clean() self.maid = nil end self.mode = nil self.Vertical = 0 NoClip:SetUser("Flight", false) local root = self._root self._root = nil if root and root.Parent then -- dựng nhân vật đứng thẳng lại root.AssemblyLinearVelocity = Vector3.zero root.CFrame = CFrame.lookAt(root.Position, root.Position + self._flat) end State:Restore("fly_hum", function(v) local _, hum = getChar() if hum then hum.PlatformStand = v[1] hum.AutoRotate = v[2] end end) end function Flight:Start(mode, flag) self:Stop() local _, hum, root = getChar() if not hum or not root then return State:Set(flag, false) end local m = Maid.new() self.maid, self.mode, self._root = m, mode, root State:Snap("fly_hum", function() return { hum.PlatformStand, hum.AutoRotate } end) hum.PlatformStand = true hum.AutoRotate = false local bv = m:Add(Instance.new("BodyVelocity")) -- vận tốc 0 khi đứng yên = không tự rơi bv.MaxForce = Vector3.one * 1e9 bv.Velocity = Vector3.zero bv.Parent = root local bg = m:Add(Instance.new("BodyGyro")) bg.MaxTorque = Vector3.one * 1e9 bg.P = 1e5 bg.D = 1e3 bg.CFrame = root.CFrame bg.Parent = root if mode == "down" then NoClip:SetUser("Flight", true) end -- đi xuống dưới mặt đất m:Add(RunService.RenderStepped:Connect(function() if not root.Parent or hum.Health <= 0 then return end local cam = Workspace.CurrentCamera local look = cam.CFrame.LookVector local flat = Vector3.new(look.X, 0, look.Z) flat = flat.Magnitude > 1e-3 and flat.Unit or Vector3.new(0, 0, -1) Flight._flat = flat local vert = Flight.Vertical if not UIS:GetFocusedTextBox() then if UIS:IsKeyDown(Enum.KeyCode.E) then vert += 1 end if UIS:IsKeyDown(Enum.KeyCode.Q) then vert -= 1 end end vert = math.clamp(vert, -1, 1) local cfg = State.Config local vspeed = (mode == "dron") and cfg.DroneRate or cfg.FlySpeed -- dron: lên/xuống chậm, mặc định 6 bv.Velocity = hum.MoveDirection * cfg.FlySpeed + Vector3.new(0, vert * vspeed, 0) if mode == "air" then bg.CFrame = CFrame.lookAt(Vector3.zero, flat) elseif mode == "dron" then bg.CFrame = orient(Vector3.new(0, -1, 0), flat) -- úp mặt xuống else bg.CFrame = orient(Vector3.new(0, 1, 0), flat) -- nằm ngửa mặt lên end end)) end for mode, flag in pairs({ air = "FlyAir", down = "FlyDown", dron = "FlyDron" }) do State:Bind(flag, function(on) if on then Flight:Start(mode, flag) elseif Flight.mode == mode then Flight:Stop() end end) end -- ===== Speed ===== local speedMaid State:Bind("Speed", function(on) if speedMaid then speedMaid:Clean() speedMaid = nil end local _, hum = getChar() if on and hum then State:Snap("walkspeed", function() return hum.WalkSpeed end) speedMaid = Maid.new() speedMaid:Add(RunService.Heartbeat:Connect(function() if hum.Parent then hum.WalkSpeed = State.Config.WalkSpeed end -- đọc config mỗi khung = đổi realtime end)) else State:Restore("walkspeed", function(v) local _, h = getChar() if h then h.WalkSpeed = v end end) end end) -- ===== Jumping Air ===== local jumpMaid State:Bind("JumpAir", function(on) if jumpMaid then jumpMaid:Clean() jumpMaid = nil end if not on then return end jumpMaid = Maid.new() local last = 0 jumpMaid:Add(UIS.JumpRequest:Connect(function() local _, hum = getChar() if hum and hum.Health > 0 and not hum.PlatformStand and os.clock() - last > 0.2 then last = os.clock() hum:ChangeState(Enum.HumanoidStateType.Jumping) end end)) end) -- ===== Night Vision ===== local NV_PROPS = { "Ambient", "OutdoorAmbient", "Brightness", "ClockTime", "FogStart", "FogEnd", "GlobalShadows" } local nvMaid State:Bind("NightVision", function(on) if nvMaid then nvMaid:Clean() nvMaid = nil end if on then State:Snap("nv", function() -- lưu cấu hình gốc local t = { atm = {} } for _, p in ipairs(NV_PROPS) do t[p] = Lighting[p] end for _, a in ipairs(Lighting:GetChildren()) do if a:IsA("Atmosphere") then t.atm[a] = { a.Density, a.Haze } end end return t end) nvMaid = Maid.new() local acc = 1 nvMaid:Add(RunService.Heartbeat:Connect(function(dt) acc += dt if acc < 0.5 then return end -- game có thể ghi đè -> áp lại mỗi 0.5s acc = 0 Lighting.Ambient = Color3.new(0.9, 0.9, 0.9) Lighting.OutdoorAmbient = Color3.new(0.9, 0.9, 0.9) Lighting.Brightness = 2 Lighting.ClockTime = 14 Lighting.FogStart = 0 Lighting.FogEnd = 1e9 Lighting.GlobalShadows = false for _, a in ipairs(Lighting:GetChildren()) do if a:IsA("Atmosphere") then a.Density = 0 a.Haze = 0 end end end)) else State:Restore("nv", function(t) for _, p in ipairs(NV_PROPS) do Lighting[p] = t[p] end for a, v in pairs(t.atm) do if a.Parent then a.Density = v[1] a.Haze = v[2] end end end) end end) -- ===== Fix Lag (tắt chứ không xoá -> khôi phục được) ===== local FL = { maid = nil, snap = setmetatable({}, { __mode = "k" }), token = nil } local FX = { ParticleEmitter = "Enabled", Trail = "Enabled", Smoke = "Enabled", Fire = "Enabled", Sparkles = "Enabled", BloomEffect = "Enabled", BlurEffect = "Enabled", ColorCorrectionEffect = "Enabled", DepthOfFieldEffect = "Enabled", SunRaysEffect = "Enabled" } local function flApply(d) local prop for cls, p in pairs(FX) do if d:IsA(cls) then prop = p break end end if not prop and d:IsA("BasePart") then prop = "CastShadow" end if not prop then return end if FL.snap[d] == nil then FL.snap[d] = { prop, d[prop] } end d[prop] = false end State:Bind("FixLag", function(on) if FL.maid then FL.maid:Clean() FL.maid = nil end FL.token = nil if on then local token = {} FL.token = token FL.maid = Maid.new() State:Snap("ql", function() return settings().Rendering.QualityLevel end) pcall(function() settings().Rendering.QualityLevel = Enum.QualityLevel.Level01 end) FL.maid:Add(Workspace.DescendantAdded:Connect(function(d) pcall(flApply, d) end)) task.spawn(function() local n = 0 for _, root in ipairs({ Workspace, Lighting }) do for _, d in ipairs(root:GetDescendants()) do if FL.token ~= token then return end pcall(flApply, d) n += 1 if n % 300 == 0 then task.wait() end -- yield để không đứng hình end end end) else for d, v in pairs(FL.snap) do if d.Parent then pcall(function() d[v[1]] = v[2] end) end end table.clear(FL.snap) State:Restore("ql", function(v) settings().Rendering.QualityLevel = v end) end end) -- Respawn: áp lại các tính năng gắn với nhân vật RootMaid:Add(LP.CharacterAdded:Connect(function() task.wait(0.5) for _, f in ipairs({ "Speed", "FlyAir", "FlyDown", "FlyDron" }) do State:Refire(f) end end)) ------------------------------------------------------------------ UIController local COL = { bg = Color3.fromRGB(24, 24, 30), panel = Color3.fromRGB(38, 38, 48), accent = Color3.fromRGB(90, 140, 255), on = Color3.fromRGB(60, 190, 110), off = Color3.fromRGB(80, 80, 92), text = Color3.fromRGB(235, 235, 240), } local function new(class, props, parent) local i = Instance.new(class) for k, v in pairs(props) do i[k] = v end i.Parent = parent return i end local function isPress(i) return i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch end local function isMove(i) return i.UserInputType == Enum.UserInputType.MouseMovement or i.UserInputType == Enum.UserInputType.Touch end local UI = { gui = nil } function UI:Build(onShutdown) local gui = new("ScreenGui", { Name = "ControlMenu", ResetOnSpawn = false, IgnoreGuiInset = true, DisplayOrder = 100 }, LP:WaitForChild("PlayerGui")) self.gui = gui local main = new("Frame", { Size = UDim2.fromOffset(300, 390), Position = UDim2.new(0, 16, 0.2, 0), BackgroundColor3 = COL.bg, BorderSizePixel = 0, Active = true }, gui) new("UICorner", { CornerRadius = UDim.new(0, 8) }, main) local header = new("Frame", { Size = UDim2.new(1, 0, 0, 32), BackgroundColor3 = COL.panel, BorderSizePixel = 0 }, main) new("UICorner", { CornerRadius = UDim.new(0, 8) }, header) new("TextLabel", { Size = UDim2.new(1, -70, 1, 0), Position = UDim2.fromOffset(10, 0), BackgroundTransparency = 1, Text = "Control Menu", TextColor3 = COL.text, Font = Enum.Font.GothamBold, TextSize = 14, TextXAlignment = Enum.TextXAlignment.Left }, header) local btnMin = new("TextButton", { Size = UDim2.fromOffset(28, 24), Position = UDim2.new(1, -62, 0.5, -12), BackgroundColor3 = COL.off, Text = "–", TextColor3 = COL.text, Font = Enum.Font.GothamBold, TextSize = 16 }, header) local btnX = new("TextButton", { Size = UDim2.fromOffset(28, 24), Position = UDim2.new(1, -32, 0.5, -12), BackgroundColor3 = Color3.fromRGB(190, 60, 60), Text = "X", TextColor3 = COL.text, Font = Enum.Font.GothamBold, TextSize = 13 }, header) new("UICorner", {}, btnMin) new("UICorner", {}, btnX) -- Kéo thả menu local dragging, dragStart, startPos header.InputBegan:Connect(function(i) if isPress(i) then dragging, dragStart, startPos = true, i.Position, main.Position end end) RootMaid:Add(UIS.InputEnded:Connect(function(i) if isPress(i) then dragging = false end end)) RootMaid:Add(UIS.InputChanged:Connect(function(i) if dragging and isMove(i) then local d = i.Position - dragStart main.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + d.X, startPos.Y.Scale, startPos.Y.Offset + d.Y) end end)) -- Thu gọn / mở rộng local body = new("Frame", { Position = UDim2.fromOffset(0, 32), Size = UDim2.new(1, 0, 1, -32), BackgroundTransparency = 1 }, main) local collapsed = false btnMin.Activated:Connect(function() collapsed = not collapsed body.Visible = not collapsed main.Size = collapsed and UDim2.fromOffset(300, 32) or UDim2.fromOffset(300, 390) btnMin.Text = collapsed and "+" or "–" end) btnX.Activated:Connect(onShutdown) -- Tab local tabNames = { "Main", "Esp", "Khác" } local pages, tabBtns = {}, {} local function selectTab(n) for name, p in pairs(pages) do p.Visible = (name == n) end for name, b in pairs(tabBtns) do b.BackgroundColor3 = (name == n) and COL.accent or COL.panel end end for idx, n in ipairs(tabNames) do local b = new("TextButton", { Size = UDim2.new(1 / 3, -4, 0, 28), Position = UDim2.new((idx - 1) / 3, 2, 0, 4), BackgroundColor3 = COL.panel, Text = n, TextColor3 = COL.text, Font = Enum.Font.GothamBold, TextSize = 13 }, body) new("UICorner", {}, b) tabBtns[n] = b b.Activated:Connect(function() selectTab(n) end) local p = new("ScrollingFrame", { Position = UDim2.fromOffset(4, 38), Size = UDim2.new(1, -8, 1, -42), BackgroundTransparency = 1, BorderSizePixel = 0, ScrollBarThickness = 4, CanvasSize = UDim2.new(), AutomaticCanvasSize = Enum.AutomaticSize.Y }, body) new("UIListLayout", { Padding = UDim.new(0, 4), SortOrder = Enum.SortOrder.LayoutOrder }, p) pages[n] = p end -- Dòng chức năng + tay nắm "≡" để kéo lên/xuống đổi thứ tự local order = 0 local function addRow(page, text) order += 1 local row = new("Frame", { Size = UDim2.new(1, -8, 0, 30), BackgroundColor3 = COL.panel, BorderSizePixel = 0, LayoutOrder = order }, page) new("UICorner", { CornerRadius = UDim.new(0, 6) }, row) local handle = new("TextButton", { Size = UDim2.fromOffset(24, 30), BackgroundTransparency = 1, Text = "≡", TextColor3 = COL.text, Font = Enum.Font.GothamBold, TextSize = 18 }, row) new("TextLabel", { Position = UDim2.fromOffset(26, 0), Size = UDim2.new(1, -96, 1, 0), BackgroundTransparency = 1, Text = text, TextColor3 = COL.text, Font = Enum.Font.Gotham, TextSize = 12, TextWrapped = true, TextXAlignment = Enum.TextXAlignment.Left }, row) local drag = false handle.InputBegan:Connect(function(i) if isPress(i) then drag = true row.BackgroundColor3 = COL.accent end end) RootMaid:Add(UIS.InputEnded:Connect(function(i) if drag and isPress(i) then drag = false row.BackgroundColor3 = COL.panel end end)) RootMaid:Add(UIS.InputChanged:Connect(function(i) if not (drag and isMove(i)) then return end local y = i.Position.Y for _, o in ipairs(page:GetChildren()) do if o ~= row and o:IsA("Frame") and y >= o.AbsolutePosition.Y and y <= o.AbsolutePosition.Y + o.AbsoluteSize.Y then row.LayoutOrder, o.LayoutOrder = o.LayoutOrder, row.LayoutOrder break end end end)) return row end local function addToggle(page, text, flag) local row = addRow(page, text) local btn = new("TextButton", { Size = UDim2.fromOffset(56, 22), Position = UDim2.new(1, -62, 0.5, -11), TextColor3 = COL.text, Font = Enum.Font.GothamBold, TextSize = 12 }, row) new("UICorner", {}, btn) local function refresh() local on = State.Flags[flag] btn.Text = on and "ON" or "OFF" btn.BackgroundColor3 = on and COL.on or COL.off end btn.Activated:Connect(function() State:Set(flag, not State.Flags[flag]) end) RootMaid:Add(State.Changed.Event:Connect(function(f) if f == flag then refresh() end end)) refresh() end local function addNumber(page, text, key, min, max) local row = addRow(page, text) local box = new("TextBox", { Size = UDim2.fromOffset(56, 22), Position = UDim2.new(1, -62, 0.5, -11), BackgroundColor3 = COL.bg, TextColor3 = COL.text, Font = Enum.Font.Gotham, TextSize = 12, ClearTextOnFocus = false, Text = tostring(State.Config[key]) }, row) new("UICorner", {}, box) box.FocusLost:Connect(function() local n = tonumber(box.Text) if n and n == n then State.Config[key] = math.clamp(n, min, max) end -- chỉ nhận số hợp lệ box.Text = tostring(State.Config[key]) end) end local P = pages addToggle(P.Main, "Tele Dron", "TeleDron") addToggle(P.Main, "Tele Kill", "TeleKill") addToggle(P.Main, "Aimbot", "Aimbot") addNumber(P.Main, "Độ cao an toàn Tele Dron", "SafeHeight", 3, 100) addNumber(P.Main, "Khoảng cách Tele Kill", "KillDistance", 2, 30) addNumber(P.Main, "Phạm vi quét (studs)", "ScanRange", 10, 300) addToggle(P.Esp, "Esp Line", "EspLine") addToggle(P.Esp, "Esp Box", "EspBox") addToggle(P.Esp, "Esp Name", "EspName") addToggle(P.Esp, "Esp Distance", "EspDistance") addToggle(P.Esp, "Esp Hologram", "EspHologram") addToggle(P.Esp, "Esp Workspace", "EspWorkspace") addToggle(P["Khác"], "Fly Down (nằm ngửa, xuyên đất)", "FlyDown") addToggle(P["Khác"], "Fly Dron (úp mặt, độ cao cố định)", "FlyDron") addToggle(P["Khác"], "Fly Air", "FlyAir") addNumber(P["Khác"], "Fly Speed", "FlySpeed", 1, 300) addNumber(P["Khác"], "Fly Dron tốc độ lên/xuống", "DroneRate", 1, 50) addToggle(P["Khác"], "No Clip", "NoClip") addToggle(P["Khác"], "Speed", "Speed") addNumber(P["Khác"], "Speed (WalkSpeed)", "WalkSpeed", 1, 200) addToggle(P["Khác"], "Jumping Air", "JumpAir") addToggle(P["Khác"], "Night Vision", "NightVision") addToggle(P["Khác"], "Fix Lag", "FixLag") selectTab("Main") -- Cụm nút tăng/giảm độ cao khi đang bay (giữ để di chuyển, thả ra là đứng yên) local pad = new("Frame", { Size = UDim2.fromOffset(70, 144), Position = UDim2.new(1, -90, 0.5, -72), BackgroundTransparency = 1, Visible = false }, gui) for idx, info in ipairs({ { "▲", 1 }, { "▼", -1 } }) do local b = new("TextButton", { Size = UDim2.fromOffset(66, 66), Position = UDim2.fromOffset(2, (idx - 1) * 76), BackgroundColor3 = COL.panel, BackgroundTransparency = 0.2, Text = info[1], TextColor3 = COL.text, Font = Enum.Font.GothamBold, TextSize = 28 }, pad) new("UICorner", {}, b) b.InputBegan:Connect(function(i) if isPress(i) then Flight.Vertical = info[2] end end) b.InputEnded:Connect(function(i) if isPress(i) then Flight.Vertical = 0 end end) end RootMaid:Add(State.Changed.Event:Connect(function() local F = State.Flags pad.Visible = (F.FlyAir or F.FlyDown or F.FlyDron) and true or false end)) end ------------------------------------------------------------------ Shutdown + khởi chạy local function Shutdown() for flag in pairs(State.Flags) do State:Set(flag, false) end -- tắt hết -> mỗi module tự khôi phục snapshot Esp:Cleanup() Combat:_stopTele() NoClip:SetUser("Flag", false) NoClip:SetUser("Flight", false) if UI.gui then UI.gui:Destroy() end RootMaid:Clean() if _G.__ControlMenuShutdown == Shutdown then _G.__ControlMenuShutdown = nil end end _G.__ControlMenuShutdown = Shutdown UI:Build(Shutdown)