--[[ CONTROL MENU - 3 tab: Main / Esp / Khác Loại: LocalScript (chạy phía client). Phạm vi quét mặc định: 150 studs. Module: StateManager, TargetScanner, CombatEngine, EspEngine, MovementAndWorld, UIController Cắm cơ chế tấn công của game: sửa hàm CombatEngine.AttackHook(target, mode) ở cuối module CombatEngine. ]] local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local Lighting = game:GetService("Lighting") local Workspace = game:GetService("Workspace") local LocalPlayer = Players.LocalPlayer local Camera = Workspace.CurrentCamera Workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(function() Camera = Workspace.CurrentCamera end) --------------------------------------------------------------------- -- TIỆN ÍCH: Janitor (dọn kết nối/Instance, chống rò rỉ khi bật/tắt nhiều lần) --------------------------------------------------------------------- local function newJanitor() local j = { items = {} } function j:Add(x) table.insert(self.items, x) return x end function j:Clean() for _, x in ipairs(self.items) do local t = typeof(x) if t == "RBXScriptConnection" then x:Disconnect() elseif t == "Instance" then pcall(function() x:Destroy() end) elseif t == "function" then pcall(x) end end table.clear(self.items) end return j end 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") or c.PrimaryPart) end --------------------------------------------------------------------- -- MODULE 1: StateManager --------------------------------------------------------------------- local StateManager = { Toggles = {}, Config = { ScanRange = 150, DroneHeightOffset = 25, FlySpeed = 60, WalkSpeed = 32, AttackInterval = 0.12, AimSmooth = 0.35, FlyDronHeight = 0, }, Snapshot = {}, -- giá trị gốc trước khi bật tính năng _listeners = {}, Exclusive = { FlyAir = "FlyDron", FlyDron = "FlyAir" }, -- 2 chế độ bay không chạy cùng lúc } function StateManager.OnChange(name, fn) StateManager._listeners[name] = StateManager._listeners[name] or {} table.insert(StateManager._listeners[name], fn) end function StateManager.Set(name, value) if StateManager.Toggles[name] == value then return end local other = StateManager.Exclusive[name] if value and other and StateManager.Get(other) then StateManager.Set(other, false) end -- tắt chế độ kia trước StateManager.Toggles[name] = value for _, fn in ipairs(StateManager._listeners[name] or {}) do task.spawn(function() local ok, e = pcall(fn, value) if not ok then warn(name, e) end end) end end function StateManager.Get(name) return StateManager.Toggles[name] == true end function StateManager.SetConfig(key, value) StateManager.Config[key] = value end --------------------------------------------------------------------- -- MODULE 2: TargetScanner (cache Humanoid theo sự kiện, quét 10 lần/giây) --------------------------------------------------------------------- local TargetScanner = { _models = {}, _list = {}, _last = 0, _interval = 0.1 } local function isHumanoidOwnerModel(hum) local m = hum.Parent return m and m:IsA("Model") and m end for _, d in ipairs(Workspace:GetDescendants()) do if d:IsA("Humanoid") then local m = isHumanoidOwnerModel(d) if m then TargetScanner._models[m] = d end end end Workspace.DescendantAdded:Connect(function(d) if d:IsA("Humanoid") then task.defer(function() local m = isHumanoidOwnerModel(d) if m then TargetScanner._models[m] = d end end) end end) Workspace.DescendantRemoving:Connect(function(d) if d:IsA("Model") then TargetScanner._models[d] = nil end end) function TargetScanner.IsValid(model) if not model or not model.Parent then return false end if model == getChar() then return false end if Players:GetPlayerFromCharacter(model) then return false end -- bỏ người chơi khác local hum = model:FindFirstChildOfClass("Humanoid") if not hum or hum.Health <= 0 then return false end local root = model:FindFirstChild("HumanoidRootPart") or model.PrimaryPart return root ~= nil, hum, root end function TargetScanner.InRange(model) local me = getRoot() local ok, _, root = TargetScanner.IsValid(model) if not (ok and me and root) then return false end return (root.Position - me.Position).Magnitude <= StateManager.Config.ScanRange end -- Trả về danh sách {model, root, hum, dist} sắp theo khoảng cách gần nhất function TargetScanner.Get() local now = os.clock() if now - TargetScanner._last < TargetScanner._interval then return TargetScanner._list end TargetScanner._last = now local me = getRoot() local list = {} if me then local range = StateManager.Config.ScanRange for model in pairs(TargetScanner._models) do local ok, hum, root = TargetScanner.IsValid(model) if ok then local d = (root.Position - me.Position).Magnitude if d <= range then table.insert(list, { model = model, root = root, hum = hum, dist = d }) end end end table.sort(list, function(a, b) return a.dist < b.dist end) end TargetScanner._list = list return list end --------------------------------------------------------------------- -- MODULE 3: CombatEngine --------------------------------------------------------------------- local CombatEngine = { _current = nil, _lastAttack = 0, _janitor = newJanitor() } --[[ CẮM CƠ CHẾ TẤN CÔNG CỦA GAME TẠI ĐÂY: target = { model, root, hum, dist }; mode = "Dron" | "Kill" | "Auto" Mặc định: kích hoạt Tool đang cầm. Nếu game dùng RemoteEvent, ví dụ: game.ReplicatedStorage.Remotes.Attack:FireServer(target.model) ]] function CombatEngine.AttackHook(target, mode) local char = getChar() local tool = char and char:FindFirstChildOfClass("Tool") if tool then tool:Activate() end end local function attackThrottled(target, mode) local now = os.clock() if now - CombatEngine._lastAttack >= StateManager.Config.AttackInterval then CombatEngine._lastAttack = now pcall(CombatEngine.AttackHook, target, mode) end end -- Khóa mục tiêu tạm thời: giữ mục tiêu đến khi chết/biến mất/ra khỏi 150, rồi tự chuyển local function pickTarget() local cur = CombatEngine._current if cur and TargetScanner.InRange(cur.model) then cur.dist = (cur.root.Position - (getRoot() and getRoot().Position or cur.root.Position)).Magnitude return cur end CombatEngine._current = TargetScanner.Get()[1] return CombatEngine._current end local function anyCombatOn() local s = StateManager return s.Get("TeleDron") or s.Get("TeleKill") or s.Get("Aimbot") or s.Get("AimMagic") or s.Get("AutoBan") end local function stepCombat() if not anyCombatOn() then CombatEngine._current = nil return end local me, hum = getRoot(), getHum() if not (me and hum and hum.Health > 0) then return end local t = pickTarget() if not t then return end local tpos = t.root.Position if StateManager.Get("TeleDron") then local pos = tpos + Vector3.new(0, StateManager.Config.DroneHeightOffset, 0) me.CFrame = CFrame.lookAt(pos, tpos) -- lơ lửng phía trên, nhìn xuống mục tiêu me.AssemblyLinearVelocity = Vector3.zero -- triệt tiêu lực rơi/đẩy lùi me.AssemblyAngularVelocity = Vector3.zero attackThrottled(t, "Dron") elseif StateManager.Get("TeleKill") then local pos = (t.root.CFrame * CFrame.new(0, 0, 3)).Position -- sau lưng mục tiêu me.CFrame = CFrame.lookAt(pos, tpos) me.AssemblyLinearVelocity = Vector3.zero attackThrottled(t, "Kill") end if StateManager.Get("Aimbot") and Camera then -- Lerp mượt, giữ nguyên mục tiêu để chống rung khi chuyển local goal = CFrame.lookAt(Camera.CFrame.Position, tpos) Camera.CFrame = Camera.CFrame:Lerp(goal, StateManager.Config.AimSmooth) end if StateManager.Get("AutoBan") and not StateManager.Get("TeleDron") and not StateManager.Get("TeleKill") then attackThrottled(t, "Auto") -- KHÔNG đụng tới Camera/con trỏ end end -- Điểm ngắm cho Aim Magic (không khóa camera); AttackHook của game có thể gọi hàm này function CombatEngine.GetMagicAimPoint() if not StateManager.Get("AimMagic") then return nil end local t = CombatEngine._current or TargetScanner.Get()[1] return t and t.root.Position or nil end -- Aim Magic: đổi Mouse.Hit khi người chơi bắn (cần executor hỗ trợ hookmetamethod; không có thì bỏ qua an toàn) do local mouse = LocalPlayer:GetMouse() if hookmetamethod and newcclosure and checkcaller then pcall(function() local old old = hookmetamethod(game, "__index", newcclosure(function(self, key) if self == mouse and key == "Hit" and not checkcaller() then local p = CombatEngine.GetMagicAimPoint() if p then return CFrame.new(p) end end return old(self, key) end)) end) end end CombatEngine._janitor:Add(RunService.Heartbeat:Connect(stepCombat)) --------------------------------------------------------------------- -- MODULE 4: EspEngine (GUI 2D + Highlight) --------------------------------------------------------------------- local EspEngine = { _objs = {}, _wsHighlights = {}, _wsJan = newJanitor(), _gui = nil } function EspEngine.Init(parentGui) local f = Instance.new("Folder") f.Name = "EspLayer" f.Parent = parentGui EspEngine._gui = f end local function newFrame(color, thick) local fr = Instance.new("Frame") fr.BackgroundTransparency = 1 fr.BorderSizePixel = 0 fr.Visible = false fr.Parent = EspEngine._gui return fr end local function stroke(fr, color) local s = Instance.new("UIStroke") s.Color = color s.Thickness = 1.5 s.Parent = fr end local function newLabel(color) local l = Instance.new("TextLabel") l.BackgroundTransparency = 1 l.TextColor3 = color l.TextStrokeTransparency = 0.3 l.Font = Enum.Font.GothamBold l.TextSize = 13 l.Size = UDim2.fromOffset(160, 14) l.AnchorPoint = Vector2.new(0.5, 0) l.Visible = false l.Parent = EspEngine._gui return l end local function destroyObj(o) for _, k in ipairs({ "box", "line", "name", "dist", "hl" }) do if o[k] then pcall(function() o[k]:Destroy() end) o[k] = nil end end end local function getObj(model) local o = EspEngine._objs[model] if not o then o = {} EspEngine._objs[model] = o end return o end local function projectBox(model) local cf, size = model:GetBoundingBox() local minX, minY, maxX, maxY = math.huge, math.huge, -math.huge, -math.huge local any = false for x = -1, 1, 2 do for y = -1, 1, 2 do for z = -1, 1, 2 do local p, vis = Camera:WorldToViewportPoint((cf * CFrame.new(size.X / 2 * x, size.Y / 2 * y, size.Z / 2 * z)).Position) if p.Z > 0 then any = true minX, minY = math.min(minX, p.X), math.min(minY, p.Y) maxX, maxY = math.max(maxX, p.X), math.max(maxY, p.Y) end end end end return any, minX, minY, maxX, maxY end local function stepEsp() local s = StateManager local want = s.Get("EspLine") or s.Get("EspBox") or s.Get("EspName") or s.Get("EspDistance") or s.Get("EspHologram") local seen = {} if want and Camera then local vp = Camera.ViewportSize for _, t in ipairs(TargetScanner.Get()) do seen[t.model] = true local o = getObj(t.model) local any, x1, y1, x2, y2 = projectBox(t.model) -- Esp Line: từ cạnh trên giữa màn hình if s.Get("EspLine") and any then o.line = o.line or newFrame() o.line.BackgroundTransparency = 0 o.line.BackgroundColor3 = Color3.fromRGB(255, 80, 80) o.line.AnchorPoint = Vector2.new(0.5, 0.5) local ax, ay = vp.X / 2, 0 local bx, by = (x1 + x2) / 2, y2 local dx, dy = bx - ax, by - ay o.line.Size = UDim2.fromOffset(math.sqrt(dx * dx + dy * dy), 1.5) o.line.Position = UDim2.fromOffset((ax + bx) / 2, (ay + by) / 2) o.line.Rotation = math.deg(math.atan2(dy, dx)) o.line.Visible = true elseif o.line then o.line.Visible = false end -- Esp Box if s.Get("EspBox") and any then if not o.box then o.box = newFrame() stroke(o.box, Color3.fromRGB(255, 255, 255)) end o.box.Position = UDim2.fromOffset(x1, y1) o.box.Size = UDim2.fromOffset(math.max(x2 - x1, 2), math.max(y2 - y1, 2)) o.box.Visible = true elseif o.box then o.box.Visible = false end -- Esp Name if s.Get("EspName") and any then o.name = o.name or newLabel(Color3.fromRGB(255, 255, 120)) o.name.Text = t.model.Name o.name.Position = UDim2.fromOffset((x1 + x2) / 2, y1 - 16) o.name.Visible = true elseif o.name then o.name.Visible = false end -- Esp Distance if s.Get("EspDistance") and any then o.dist = o.dist or newLabel(Color3.fromRGB(120, 220, 255)) o.dist.Text = string.format("%.0f studs", t.dist) o.dist.Position = UDim2.fromOffset((x1 + x2) / 2, y2 + 2) o.dist.Visible = true elseif o.dist then o.dist.Visible = false end -- Esp Hologram (Highlight xuyên tường) if s.Get("EspHologram") then if not o.hl or not o.hl.Parent then local h = Instance.new("Highlight") h.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop h.FillColor = Color3.fromRGB(0, 255, 200) h.FillTransparency = 0.6 h.Adornee = t.model h.Parent = EspEngine._gui o.hl = h end elseif o.hl then o.hl:Destroy() o.hl = nil end end end -- Dọn mục tiêu ra khỏi tầm / bị hủy / tính năng đã tắt for model, o in pairs(EspEngine._objs) do if not seen[model] then destroyObj(o) EspEngine._objs[model] = nil end end end function EspEngine.CleanupAll() for m, o in pairs(EspEngine._objs) do destroyObj(o) EspEngine._objs[m] = nil end end -- Esp Workspace: workspace.Item (kiểm tra tồn tại an toàn) local function addWsHighlight(inst) if EspEngine._wsHighlights[inst] then return end if inst:IsA("Model") or inst:IsA("BasePart") then local h = Instance.new("Highlight") h.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop h.FillColor = Color3.fromRGB(255, 200, 0) h.FillTransparency = 0.6 h.Adornee = inst h.Parent = EspEngine._gui EspEngine._wsHighlights[inst] = h end end StateManager.OnChange("EspWorkspace", function(on) EspEngine._wsJan:Clean() for inst, h in pairs(EspEngine._wsHighlights) do pcall(function() h:Destroy() end) EspEngine._wsHighlights[inst] = nil end if not on then return end local folder = Workspace:FindFirstChild("Item") if not folder then warn("[Esp Workspace] workspace.Item không tồn tại") return end for _, c in ipairs(folder:GetChildren()) do addWsHighlight(c) end EspEngine._wsJan:Add(folder.ChildAdded:Connect(addWsHighlight)) EspEngine._wsJan:Add(folder.ChildRemoved:Connect(function(c) local h = EspEngine._wsHighlights[c] if h then h:Destroy() EspEngine._wsHighlights[c] = nil end end)) end) for _, n in ipairs({ "EspLine", "EspBox", "EspName", "EspDistance", "EspHologram" }) do StateManager.OnChange(n, function(on) if not on then EspEngine.CleanupAll() end end) end RunService.RenderStepped:Connect(stepEsp) --------------------------------------------------------------------- -- MODULE 5: MovementAndWorld --------------------------------------------------------------------- local Move = { fly = newJanitor(), noclip = newJanitor(), speed = newJanitor(), jump = newJanitor(), up = false, down = false } local ccSnap = setmetatable({}, { __mode = "k" }) -- No Clip StateManager.OnChange("NoClip", function(on) Move.noclip:Clean() if on then Move.noclip:Add(RunService.Stepped:Connect(function() local c = getChar() if not c then return end for _, p in ipairs(c:GetDescendants()) do if p:IsA("BasePart") then if ccSnap[p] == nil then ccSnap[p] = p.CanCollide end p.CanCollide = false end end end)) else for p, v in pairs(ccSnap) do if p.Parent then p.CanCollide = v end ccSnap[p] = nil end end end) -- Fly Air (giữ độ cao khi đứng yên vì Velocity = 0 do BodyVelocity) StateManager.OnChange("FlyAir", function(on) Move.fly:Clean() local hum = getHum() if hum and StateManager.Snapshot.PlatformStand ~= nil and not on then hum.PlatformStand = StateManager.Snapshot.PlatformStand StateManager.Snapshot.PlatformStand = nil end if not on then return end local root = getRoot() if not (root and hum) then return end StateManager.Snapshot.PlatformStand = hum.PlatformStand hum.PlatformStand = true local bv = Move.fly:Add(Instance.new("BodyVelocity")) bv.MaxForce = Vector3.new(9e9, 9e9, 9e9) bv.Velocity = Vector3.zero bv.Parent = root local bg = Move.fly:Add(Instance.new("BodyGyro")) bg.MaxTorque = Vector3.new(9e9, 9e9, 9e9) bg.P = 9e4 bg.CFrame = root.CFrame bg.Parent = root Move.fly:Add(RunService.RenderStepped:Connect(function() local h = getHum() if not (h and root.Parent) then return end local sp = StateManager.Config.FlySpeed local v = (h.MoveDirection * sp) local vert = ((Move.up and 1 or 0) - (Move.down and 1 or 0)) * sp bv.Velocity = Vector3.new(v.X, vert, v.Z) bg.CFrame = CFrame.new(root.Position, root.Position + Camera.CFrame.LookVector * Vector3.new(1, 0, 1)) end)) end) -- Fly Dron: lơ lửng ở độ cao CỐ ĐỊNH, chỉ di chuyển ngang, thân úp mặt xuống đất Move.drone = newJanitor() StateManager.OnChange("FlyDron", function(on) Move.drone:Clean() local hum = getHum() if not on then if hum and StateManager.Snapshot.DronePlatformStand ~= nil then hum.PlatformStand = StateManager.Snapshot.DronePlatformStand end StateManager.Snapshot.DronePlatformStand = nil return end local root = getRoot() if not (root and hum) then return end StateManager.Snapshot.DronePlatformStand = hum.PlatformStand hum.PlatformStand = true local flatLook = root.CFrame.LookVector * Vector3.new(1, 0, 1) -- hướng ngang ban đầu flatLook = flatLook.Magnitude > 0.01 and flatLook.Unit or Vector3.new(0, 0, -1) local FACE_DOWN = CFrame.Angles(-math.pi / 2, 0, 0) -- úp mặt xuống đất local baseY = root.Position.Y -- độ cao khóa tại lúc bật; FlyDronHeight cộng thêm, chỉnh được theo thời gian thực local bv = Move.drone:Add(Instance.new("BodyVelocity")) bv.MaxForce = Vector3.new(9e9, 9e9, 9e9) bv.Velocity = Vector3.zero bv.Parent = root local bg = Move.drone:Add(Instance.new("BodyGyro")) bg.MaxTorque = Vector3.new(9e9, 9e9, 9e9) bg.P = 9e4 bg.CFrame = CFrame.lookAt(root.Position, root.Position + flatLook) * FACE_DOWN bg.Parent = root Move.drone:Add(RunService.RenderStepped:Connect(function() local h = getHum() if not (h and root.Parent) then return end local sp = StateManager.Config.FlySpeed local m = h.MoveDirection local targetY = baseY + StateManager.Config.FlyDronHeight local vy = math.clamp((targetY - root.Position.Y) * 8, -sp, sp) -- giữ đúng độ cao, không rơi bv.Velocity = Vector3.new(m.X * sp, vy, m.Z * sp) local cl = Camera.CFrame.LookVector local flat = Vector3.new(cl.X, 0, cl.Z) if flat.Magnitude > 0.01 then flatLook = flat.Unit end -- nhìn thẳng lên/xuống thì giữ hướng cũ, không xoay loạn bg.CFrame = CFrame.lookAt(root.Position, root.Position + flatLook) * FACE_DOWN end)) end) -- Speed StateManager.OnChange("Speed", function(on) Move.speed:Clean() local hum = getHum() if on then if hum then StateManager.Snapshot.WalkSpeed = hum.WalkSpeed end Move.speed:Add(RunService.Heartbeat:Connect(function() local h = getHum() if h then h.WalkSpeed = StateManager.Config.WalkSpeed end end)) elseif hum and StateManager.Snapshot.WalkSpeed then hum.WalkSpeed = StateManager.Snapshot.WalkSpeed StateManager.Snapshot.WalkSpeed = nil end end) -- Jumping Air StateManager.OnChange("JumpingAir", function(on) Move.jump:Clean() if on then Move.jump:Add(UserInputService.JumpRequest:Connect(function() local h = getHum() if h and h.Health > 0 then h:ChangeState(Enum.HumanoidStateType.Jumping) end end)) end end) -- Night Vision local lightKeys = { "Brightness", "ClockTime", "FogEnd", "FogStart", "GlobalShadows", "Ambient", "OutdoorAmbient" } StateManager.OnChange("NightVision", function(on) local snap = StateManager.Snapshot if on then snap.Light = {} for _, k in ipairs(lightKeys) do snap.Light[k] = Lighting[k] end snap.Atmos = {} for _, a in ipairs(Lighting:GetChildren()) do if a:IsA("Atmosphere") then snap.Atmos[a] = a.Density a.Density = 0 end end Lighting.Brightness = 2 Lighting.ClockTime = 14 Lighting.FogEnd = 1e9 Lighting.FogStart = 1e9 Lighting.GlobalShadows = false Lighting.Ambient = Color3.new(1, 1, 1) Lighting.OutdoorAmbient = Color3.new(1, 1, 1) elseif snap.Light then for k, v in pairs(snap.Light) do Lighting[k] = v end for a, d in pairs(snap.Atmos or {}) do if a.Parent then a.Density = d end end snap.Light, snap.Atmos = nil, nil end end) -- Fix Lag (lưu trạng thái để khôi phục khi tắt) local lagSnap = {} StateManager.OnChange("FixLag", function(on) if on then lagSnap.shadows = Lighting.GlobalShadows Lighting.GlobalShadows = false for _, d in ipairs(Workspace:GetDescendants()) do if d:IsA("ParticleEmitter") or d:IsA("Trail") or d:IsA("Smoke") or d:IsA("Fire") or d:IsA("Sparkles") then lagSnap[d] = d.Enabled d.Enabled = false end end for _, e in ipairs(Lighting:GetChildren()) do if e:IsA("PostEffect") or e:IsA("BlurEffect") or e:IsA("SunRaysEffect") or e:IsA("BloomEffect") then lagSnap[e] = e.Enabled e.Enabled = false end end else if lagSnap.shadows ~= nil then Lighting.GlobalShadows = lagSnap.shadows end for k, v in pairs(lagSnap) do if typeof(k) == "Instance" and k.Parent then k.Enabled = v end end table.clear(lagSnap) end end) --------------------------------------------------------------------- -- MODULE 6: UIController --------------------------------------------------------------------- local UIController = {} do local parent = (gethui and gethui()) or LocalPlayer:WaitForChild("PlayerGui") local old = parent:FindFirstChild("ControlMenuGui") if old then old:Destroy() end local gui = Instance.new("ScreenGui") gui.Name = "ControlMenuGui" gui.ResetOnSpawn = false gui.IgnoreGuiInset = true gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling gui.Parent = parent EspEngine.Init(gui) local main = Instance.new("Frame") main.Size = UDim2.fromOffset(260, 340) main.Position = UDim2.fromOffset(20, 80) main.BackgroundColor3 = Color3.fromRGB(25, 25, 32) main.BorderSizePixel = 0 main.Active = true main.Parent = gui Instance.new("UICorner", main).CornerRadius = UDim.new(0, 8) local top = Instance.new("Frame") top.Size = UDim2.new(1, 0, 0, 30) top.BackgroundColor3 = Color3.fromRGB(40, 40, 55) top.BorderSizePixel = 0 top.Parent = main Instance.new("UICorner", top).CornerRadius = UDim.new(0, 8) local title = Instance.new("TextLabel") title.Size = UDim2.new(1, -40, 1, 0) title.Position = UDim2.fromOffset(10, 0) title.BackgroundTransparency = 1 title.Text = "Control Menu" title.TextXAlignment = Enum.TextXAlignment.Left title.TextColor3 = Color3.new(1, 1, 1) title.Font = Enum.Font.GothamBold title.TextSize = 14 title.Parent = top local collapse = Instance.new("TextButton") collapse.Size = UDim2.fromOffset(28, 24) collapse.Position = UDim2.new(1, -32, 0, 3) collapse.Text = "-" collapse.BackgroundColor3 = Color3.fromRGB(70, 70, 90) collapse.TextColor3 = Color3.new(1, 1, 1) collapse.Font = Enum.Font.GothamBold collapse.TextSize = 16 collapse.Parent = top -- Kéo thả (chuột + cảm ứng) local dragging, dragStart, startPos top.InputBegan:Connect(function(i) if i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch then dragging, dragStart, startPos = true, i.Position, main.Position end end) UserInputService.InputChanged:Connect(function(i) if dragging and (i.UserInputType == Enum.UserInputType.MouseMovement or i.UserInputType == Enum.UserInputType.Touch) 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) UserInputService.InputEnded:Connect(function(i) if i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch then dragging = false end end) local body = Instance.new("Frame") body.Size = UDim2.new(1, 0, 1, -30) body.Position = UDim2.fromOffset(0, 30) body.BackgroundTransparency = 1 body.Parent = main collapse.MouseButton1Click:Connect(function() body.Visible = not body.Visible main.Size = body.Visible and UDim2.fromOffset(260, 340) or UDim2.fromOffset(260, 30) collapse.Text = body.Visible and "-" or "+" end) local tabBar = Instance.new("Frame") tabBar.Size = UDim2.new(1, -10, 0, 28) tabBar.Position = UDim2.fromOffset(5, 4) tabBar.BackgroundTransparency = 1 tabBar.Parent = body local tl = Instance.new("UIListLayout", tabBar) tl.FillDirection = Enum.FillDirection.Horizontal tl.Padding = UDim.new(0, 4) local pages, tabBtns = {}, {} local function makePage(name) local p = Instance.new("ScrollingFrame") p.Size = UDim2.new(1, -10, 1, -40) p.Position = UDim2.fromOffset(5, 36) p.BackgroundTransparency = 1 p.ScrollBarThickness = 3 p.CanvasSize = UDim2.new() p.AutomaticCanvasSize = Enum.AutomaticSize.Y p.BorderSizePixel = 0 p.Visible = false p.Parent = body local l = Instance.new("UIListLayout", p) l.Padding = UDim.new(0, 4) l.SortOrder = Enum.SortOrder.LayoutOrder pages[name] = p local b = Instance.new("TextButton") b.Size = UDim2.fromOffset(78, 28) b.Text = name b.Font = Enum.Font.GothamBold b.TextSize = 13 b.TextColor3 = Color3.new(1, 1, 1) b.BackgroundColor3 = Color3.fromRGB(50, 50, 65) b.Parent = tabBar Instance.new("UICorner", b) tabBtns[name] = b b.MouseButton1Click:Connect(function() for n, pg in pairs(pages) do pg.Visible = (n == name) tabBtns[n].BackgroundColor3 = (n == name) and Color3.fromRGB(0, 130, 255) or Color3.fromRGB(50, 50, 65) end end) return p end -- Mỗi chức năng = 1 nhóm (nút ON/OFF + ô số nếu có), có tay cầm "≡" để kéo lên/xuống đổi thứ tự local rowsByPage, dragRow, dragPage = {}, nil, nil local GuiService = game:GetService("GuiService") local function reorder(page, row, pointerY) local list = rowsByPage[page] local idx = table.find(list, row) if not idx then return end local newIdx = idx for i, r in ipairs(list) do if r ~= row then local mid = r.AbsolutePosition.Y + r.AbsoluteSize.Y / 2 if i < idx and pointerY < mid then newIdx = math.min(newIdx, i) elseif i > idx and pointerY > mid then newIdx = math.max(newIdx, i) end end end if newIdx ~= idx then table.remove(list, idx) table.insert(list, newIdx, row) for i, r in ipairs(list) do r.LayoutOrder = i end end end UserInputService.InputChanged:Connect(function(i) if dragRow and (i.UserInputType == Enum.UserInputType.MouseMovement or i.UserInputType == Enum.UserInputType.Touch) then reorder(dragPage, dragRow, i.Position.Y + GuiService:GetGuiInset().Y) end end) UserInputService.InputEnded:Connect(function(i) if i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch then dragRow = nil end end) local function buildNumber(parent, label, cfgKey, minV, maxV) local row = Instance.new("Frame") row.Size = UDim2.new(1, -8, 0, 26) row.Position = UDim2.fromOffset(4, 0) row.BackgroundTransparency = 1 row.LayoutOrder = 2 row.Parent = parent local l = Instance.new("TextLabel") l.Size = UDim2.new(0.6, 0, 1, 0) l.BackgroundTransparency = 1 l.Text = label l.TextColor3 = Color3.new(1, 1, 1) l.Font = Enum.Font.Gotham l.TextSize = 12 l.TextXAlignment = Enum.TextXAlignment.Left l.Parent = row local tb = Instance.new("TextBox") tb.Size = UDim2.new(0.4, 0, 1, 0) tb.Position = UDim2.fromScale(0.6, 0) tb.Text = tostring(StateManager.Config[cfgKey]) tb.BackgroundColor3 = Color3.fromRGB(25, 25, 33) tb.TextColor3 = Color3.new(1, 1, 1) tb.Font = Enum.Font.Gotham tb.TextSize = 13 tb.ClearTextOnFocus = false tb.Parent = row Instance.new("UICorner", tb) tb.FocusLost:Connect(function() local n = tonumber(tb.Text) if n then StateManager.SetConfig(cfgKey, math.clamp(n, minV, maxV)) end -- chỉ nhận số hợp lệ tb.Text = tostring(StateManager.Config[cfgKey]) end) end local function addToggle(page, label, key, extra) rowsByPage[page] = rowsByPage[page] or {} local group = Instance.new("Frame") group.Size = UDim2.new(1, -6, 0, 0) group.AutomaticSize = Enum.AutomaticSize.Y group.BackgroundColor3 = Color3.fromRGB(35, 35, 46) group.BorderSizePixel = 0 group.LayoutOrder = #rowsByPage[page] + 1 group.Parent = page Instance.new("UICorner", group) local gl = Instance.new("UIListLayout", group) gl.Padding = UDim.new(0, 3) gl.SortOrder = Enum.SortOrder.LayoutOrder table.insert(rowsByPage[page], group) local line = Instance.new("Frame") line.Size = UDim2.new(1, 0, 0, 28) line.BackgroundTransparency = 1 line.LayoutOrder = 1 line.Parent = group local handle = Instance.new("TextButton") handle.Size = UDim2.fromOffset(28, 28) handle.Text = "≡" handle.TextSize = 18 handle.Font = Enum.Font.GothamBold handle.TextColor3 = Color3.fromRGB(200, 200, 210) handle.BackgroundColor3 = Color3.fromRGB(55, 55, 70) handle.Parent = line Instance.new("UICorner", handle) handle.InputBegan:Connect(function(i) if i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch then dragRow, dragPage = group, page end end) local b = Instance.new("TextButton") b.Size = UDim2.new(1, -32, 1, 0) b.Position = UDim2.fromOffset(32, 0) b.Font = Enum.Font.Gotham b.TextSize = 13 b.TextColor3 = Color3.new(1, 1, 1) b.Parent = line Instance.new("UICorner", b) local function refresh() local on = StateManager.Get(key) b.Text = label .. " [" .. (on and "ON" or "OFF") .. "]" b.BackgroundColor3 = on and Color3.fromRGB(30, 140, 70) or Color3.fromRGB(45, 45, 58) end refresh() StateManager.OnChange(key, refresh) -- đồng bộ khi bị tắt từ nơi khác (loại trừ, hồi sinh) b.MouseButton1Click:Connect(function() StateManager.Set(key, not StateManager.Get(key)) refresh() end) if extra then buildNumber(group, extra[1], extra[2], extra[3], extra[4]) end end local pMain, pEsp, pOther = makePage("Main"), makePage("Esp"), makePage("Khác") addToggle(pMain, "Tele Dron", "TeleDron", { "Độ cao an toàn", "DroneHeightOffset", 5, 100 }) addToggle(pMain, "Tele Kill", "TeleKill") addToggle(pMain, "Aimbot", "Aimbot") addToggle(pMain, "Aim Magic", "AimMagic") addToggle(pMain, "Auto Bắn", "AutoBan") addToggle(pEsp, "Esp Line", "EspLine") addToggle(pEsp, "Esp Box", "EspBox") addToggle(pEsp, "Esp Name", "EspName") addToggle(pEsp, "Esp Distance", "EspDistance") addToggle(pEsp, "Esp Hologram", "EspHologram") addToggle(pEsp, "Esp Workspace", "EspWorkspace") addToggle(pOther, "Fly Dron", "FlyDron", { "Chỉnh độ cao (+/-)", "FlyDronHeight", -50, 200 }) addToggle(pOther, "No Clip", "NoClip") addToggle(pOther, "Fly Air", "FlyAir", { "Fly Speed", "FlySpeed", 5, 300 }) addToggle(pOther, "Speed", "Speed", { "Walk Speed", "WalkSpeed", 1, 200 }) addToggle(pOther, "Jumping Air", "JumpingAir") addToggle(pOther, "Night Vision", "NightVision") addToggle(pOther, "Fix Lag", "FixLag") pages["Main"].Visible = true tabBtns["Main"].BackgroundColor3 = Color3.fromRGB(0, 130, 255) -- Cụm nút tăng/giảm độ cao (chỉ hiện khi Fly Air bật) local fb = Instance.new("Frame") fb.Size = UDim2.fromOffset(60, 130) fb.Position = UDim2.new(1, -80, 0.5, -65) fb.BackgroundTransparency = 1 fb.Visible = false fb.Parent = gui local function holdBtn(text, y, flag) local b = Instance.new("TextButton") b.Size = UDim2.fromOffset(60, 60) b.Position = UDim2.fromOffset(0, y) b.Text = text b.TextSize = 28 b.Font = Enum.Font.GothamBold b.TextColor3 = Color3.new(1, 1, 1) b.BackgroundColor3 = Color3.fromRGB(0, 0, 0) b.BackgroundTransparency = 0.4 b.Parent = fb Instance.new("UICorner", b).CornerRadius = UDim.new(1, 0) b.InputBegan:Connect(function(i) if i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch then Move[flag] = true end end) b.InputEnded:Connect(function(i) if i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch then Move[flag] = false end end) end holdBtn("▲", 0, "up") holdBtn("▼", 70, "down") StateManager.OnChange("FlyAir", function(on) fb.Visible = on Move.up, Move.down = false, false end) UIController.Gui = gui end -- Tắt sạch mọi thứ khi nhân vật hồi sinh (tránh kẹt trạng thái/kết nối) LocalPlayer.CharacterAdded:Connect(function() for _, k in ipairs({ "FlyAir", "FlyDron", "NoClip", "Speed" }) do if StateManager.Get(k) then StateManager.Toggles[k] = false for _, fn in ipairs(StateManager._listeners[k] or {}) do pcall(fn, false) end end end end)