--[[ ModularControlMenu.lua Bộ công cụ Debug & QA Testing nội bộ (LocalScript). Chỉ chạy khi LocalPlayer.UserId == game.CreatorId. Đặt vào StarterPlayerScripts. ]] local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local Workspace = game:GetService("Workspace") local Lighting = game:GetService("Lighting") local ReplicatedStorage = game:GetService("ReplicatedStorage") local LocalPlayer = Players.LocalPlayer if not LocalPlayer or LocalPlayer.UserId ~= game.CreatorId then return end if _G.QA_ModularMenuUnload then pcall(_G.QA_ModularMenuUnload) end local Connections = {} local function track(conn) table.insert(Connections, conn) return conn end local function GetRoot() local char = LocalPlayer.Character return char and char:FindFirstChild("HumanoidRootPart") end local function GetHumanoid() local char = LocalPlayer.Character return char and char:FindFirstChildOfClass("Humanoid") end ---------------------------------------------------------------------- -- StateManager ---------------------------------------------------------------------- local StateManager = {} StateManager.Config = { ScanRange = 150, DroneHeightOffset = 12, FlySpeed = 60, WalkSpeed = 16, AimSmooth = 0.25, AutoFireInterval = 0.2, TeleKillDistance = 4, } StateManager.Limits = { ScanRange = { 10, 1000 }, DroneHeightOffset = { 1, 200 }, FlySpeed = { 1, 500 }, WalkSpeed = { 1, 300 }, } StateManager.Flags = {} StateManager.Snapshots = {} StateManager._handlers = {} StateManager._listeners = {} StateManager._exclusive = { TeleDron = { "TeleKill", "Fly" }, TeleKill = { "TeleDron" }, Fly = { "TeleDron" }, } function StateManager.Register(key, enableFn, disableFn) StateManager._handlers[key] = { Enable = enableFn, Disable = disableFn } end function StateManager.IsOn(key) return StateManager.Flags[key] == true end function StateManager.OnChanged(fn) table.insert(StateManager._listeners, fn) end local function fireChanged(key, value) for _, fn in ipairs(StateManager._listeners) do task.spawn(fn, key, value) end end function StateManager.Set(key, value) value = value and true or false if (StateManager.Flags[key] or false) == value then return end if value then for _, other in ipairs(StateManager._exclusive[key] or {}) do StateManager.Set(other, false) end end StateManager.Flags[key] = value local h = StateManager._handlers[key] if h then local fn = value and h.Enable or h.Disable if fn then local ok, err = pcall(fn) if not ok then warn("[QA Menu] " .. key .. " lỗi: " .. tostring(err)) end end end fireChanged(key, value) end function StateManager.Reapply(key) local h = StateManager._handlers[key] if not h or not StateManager.IsOn(key) then return end pcall(h.Disable) pcall(h.Enable) end function StateManager.SetConfig(key, value) local lim = StateManager.Limits[key] if lim then value = math.clamp(value, lim[1], lim[2]) end StateManager.Config[key] = value return value end function StateManager.TakeSnapshot(key, data) StateManager.Snapshots[key] = data end function StateManager.PopSnapshot(key) local data = StateManager.Snapshots[key] StateManager.Snapshots[key] = nil return data end ---------------------------------------------------------------------- -- TargetScanner ---------------------------------------------------------------------- local TargetScanner = { List = {}, Interval = 0.2, _acc = 0 } local scanParams = OverlapParams.new() scanParams.FilterType = Enum.RaycastFilterType.Exclude local SCAN_FLAGS = { "TeleDron", "TeleKill", "Aimbot", "AimMagic", "AutoFire", "EspLine", "EspBox", "EspName", "EspDistance", "EspHologram", } function TargetScanner.IsActive() for _, key in ipairs(SCAN_FLAGS) do if StateManager.IsOn(key) then return true end end return false end local function resolveModel(part) local inst = part.Parent while inst and inst ~= Workspace do if inst:IsA("Model") and inst:FindFirstChildOfClass("Humanoid") then return inst end inst = inst.Parent end return nil end function TargetScanner.Refresh() local root = GetRoot() if not root then TargetScanner.List = {} return end local myChar = LocalPlayer.Character scanParams.FilterDescendantsInstances = { myChar } local range = StateManager.Config.ScanRange local origin = root.Position local parts = Workspace:GetPartBoundsInRadius(origin, range, scanParams) local seen, result = {}, {} for _, part in ipairs(parts) do local model = resolveModel(part) if model and not seen[model] and model ~= myChar then seen[model] = true local hum = model:FindFirstChildOfClass("Humanoid") if hum and hum.Health > 0 and Players:GetPlayerFromCharacter(model) == nil then local r = model:FindFirstChild("HumanoidRootPart") or model.PrimaryPart if r and r:IsA("BasePart") then local d = (r.Position - origin).Magnitude if d <= range then table.insert(result, { Model = model, Humanoid = hum, Root = r, Distance = d }) end end end end end table.sort(result, function(a, b) return a.Distance < b.Distance end) TargetScanner.List = result end function TargetScanner.Step(dt) if not TargetScanner.IsActive() then if #TargetScanner.List > 0 then TargetScanner.List = {} end return end TargetScanner._acc += dt if TargetScanner._acc >= TargetScanner.Interval then TargetScanner._acc = 0 TargetScanner.Refresh() end end ---------------------------------------------------------------------- -- CombatEngine ---------------------------------------------------------------------- local CombatEngine = { Target = nil, CustomHook = nil, _last = {} } local drone = { bp = nil, bg = nil } function CombatEngine.IsTargetValid(t) if not t or not t.Model or not t.Model.Parent then return false end if not t.Humanoid or not t.Humanoid.Parent or t.Humanoid.Health <= 0 then return false end if not t.Root or not t.Root.Parent then return false end local root = GetRoot() if not root then return false end return (t.Root.Position - root.Position).Magnitude <= StateManager.Config.ScanRange end function CombatEngine.GetNearest() for _, t in ipairs(TargetScanner.List) do if CombatEngine.IsTargetValid(t) then return t end end return nil end function CombatEngine.GetTarget() if not CombatEngine.IsTargetValid(CombatEngine.Target) then CombatEngine.Target = CombatEngine.GetNearest() end return CombatEngine.Target end function CombatEngine.GetAimPosition(t) local head = t.Model:FindFirstChild("Head") if head and head:IsA("BasePart") then return head.Position end return t.Root.Position end -- Hook kiểm thử: thay thế bằng CustomHook hoặc tạo BindableEvent/RemoteEvent "QATestAttack" trong ReplicatedStorage. function CombatEngine.AttackHook(target, mode, aimWorldPos) if CombatEngine.CustomHook then pcall(CombatEngine.CustomHook, target, mode, aimWorldPos) return end local char = LocalPlayer.Character local tool = char and char:FindFirstChildOfClass("Tool") if tool then pcall(function() tool:Activate() end) end local ev = ReplicatedStorage:FindFirstChild("QATestAttack") if ev then local model = target and target.Model if ev:IsA("BindableEvent") then ev:Fire(model, mode, aimWorldPos) elseif ev:IsA("RemoteEvent") then ev:FireServer(model, mode, aimWorldPos) end end end function CombatEngine.TryAttack(mode, target, aimPos) local now = os.clock() if now - (CombatEngine._last[mode] or 0) < StateManager.Config.AutoFireInterval then return end CombatEngine._last[mode] = now CombatEngine.AttackHook(target, mode, aimPos) end function CombatEngine.EnableDrone() local root, hum = GetRoot(), GetHumanoid() if not root then return end StateManager.TakeSnapshot("Drone", { AutoRotate = hum and hum.AutoRotate }) local bp = Instance.new("BodyPosition") bp.MaxForce = Vector3.new(1e9, 1e9, 1e9) bp.P = 40000 bp.D = 2000 bp.Position = root.Position bp.Parent = root local bg = Instance.new("BodyGyro") bg.MaxTorque = Vector3.new(1e9, 1e9, 1e9) bg.P = 30000 bg.D = 1000 bg.CFrame = root.CFrame bg.Parent = root drone.bp, drone.bg = bp, bg if hum then hum.AutoRotate = false end end function CombatEngine.DisableDrone() if drone.bp then drone.bp:Destroy() end if drone.bg then drone.bg:Destroy() end drone.bp, drone.bg = nil, nil local snap = StateManager.PopSnapshot("Drone") local hum = GetHumanoid() if hum and snap and snap.AutoRotate ~= nil then hum.AutoRotate = snap.AutoRotate end local root = GetRoot() if root then root.AssemblyLinearVelocity = Vector3.zero root.AssemblyAngularVelocity = Vector3.zero end end function CombatEngine.Step(dt) local root = GetRoot() if not root then return end local F = StateManager.Flags local target = nil if F.TeleDron or F.TeleKill or F.AutoFire then target = CombatEngine.GetTarget() end if F.TeleKill and target then local tpos = target.Root.Position local away = root.Position - tpos away = Vector3.new(away.X, 0, away.Z) local dir = away.Magnitude > 0.1 and away.Unit or Vector3.new(0, 0, 1) local dest = tpos + dir * StateManager.Config.TeleKillDistance root.CFrame = CFrame.lookAt(dest, Vector3.new(tpos.X, dest.Y, tpos.Z)) root.AssemblyLinearVelocity = Vector3.zero CombatEngine.TryAttack("TeleKill", target, CombatEngine.GetAimPosition(target)) end if F.TeleDron and drone.bp and drone.bp.Parent and drone.bg and drone.bg.Parent then if target then local tpos = target.Root.Position drone.bp.Position = tpos + Vector3.new(0, StateManager.Config.DroneHeightOffset, 0) if (tpos - root.Position).Magnitude > 0.5 then drone.bg.CFrame = CFrame.lookAt(root.Position, tpos) end CombatEngine.TryAttack("TeleDron", target, CombatEngine.GetAimPosition(target)) else drone.bp.Position = root.Position end root.AssemblyLinearVelocity = Vector3.zero end if F.AutoFire and target then CombatEngine.TryAttack("AutoFire", target, CombatEngine.GetAimPosition(target)) end end function CombatEngine.StepCamera() if not StateManager.IsOn("Aimbot") then return end local cam = Workspace.CurrentCamera local target = CombatEngine.GetTarget() if not cam or not target then return end local aimPos = CombatEngine.GetAimPosition(target) local goal = CFrame.lookAt(cam.CFrame.Position, aimPos) cam.CFrame = cam.CFrame:Lerp(goal, StateManager.Config.AimSmooth) end track(UserInputService.InputBegan:Connect(function(input, processed) if processed or not StateManager.IsOn("AimMagic") then return end if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then local target = CombatEngine.GetNearest() if target then CombatEngine.AttackHook(target, "AimMagic", CombatEngine.GetAimPosition(target)) end end end)) StateManager.Register("TeleDron", CombatEngine.EnableDrone, CombatEngine.DisableDrone) StateManager.Register("TeleKill", function() CombatEngine.Target = nil end, function() CombatEngine.Target = nil end) StateManager.Register("Aimbot", function() CombatEngine.Target = nil end, nil) ---------------------------------------------------------------------- -- EspEngine ---------------------------------------------------------------------- local EspEngine = { Entries = {}, ItemHighlights = {}, _itemAcc = 0 } local hasDrawing = (type(Drawing) == "table" and type(Drawing.new) == "function") local ESP_COLOR = Color3.fromRGB(255, 70, 70) local warnedDrawing = false local function newDrawing(kind) if not hasDrawing then return nil end local ok, obj = pcall(Drawing.new, kind) if ok then return obj end return nil end local function removeDrawing(obj) if not obj then return end local ok = pcall(function() obj:Remove() end) if not ok then pcall(function() obj:Destroy() end) end end local function destroyEntry(e) removeDrawing(e.Line) removeDrawing(e.Box) removeDrawing(e.Name) removeDrawing(e.Dist) if e.Highlight then e.Highlight:Destroy() end end local function hideDrawings(e) if e.Line then e.Line.Visible = false end if e.Box then e.Box.Visible = false end if e.Name then e.Name.Visible = false end if e.Dist then e.Dist.Visible = false end end local function ensureText(e, key) if not e[key] then local t = newDrawing("Text") if t then t.Size = 14 t.Center = true t.Outline = true t.Color = Color3.new(1, 1, 1) t.Font = 2 end e[key] = t end return e[key] end local function updateEntry(e, t, cam, root, dist) local F = StateManager.Flags -- Hologram (Highlight 3D) if F.EspHologram then if not e.Highlight or not e.Highlight.Parent then local h = Instance.new("Highlight") h.Name = "QA_Hologram" h.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop h.FillColor = ESP_COLOR h.FillTransparency = 0.6 h.OutlineColor = Color3.new(1, 1, 1) h.Adornee = t.Model h.Parent = t.Model e.Highlight = h end elseif e.Highlight then e.Highlight:Destroy() e.Highlight = nil end -- Drawing 2D local anyDraw = F.EspLine or F.EspBox or F.EspName or F.EspDistance if not anyDraw or not hasDrawing then hideDrawings(e) return end local cf, size = t.Model:GetBoundingBox() local hx, hy, hz = size.X / 2, size.Y / 2, size.Z / 2 local minX, minY, maxX, maxY = math.huge, math.huge, -math.huge, -math.huge local visible = false for sx = -1, 1, 2 do for sy = -1, 1, 2 do for sz = -1, 1, 2 do local wp = cf:PointToWorldSpace(Vector3.new(hx * sx, hy * sy, hz * sz)) local sp = cam:WorldToViewportPoint(wp) if sp.Z > 0 then visible = true if sp.X < minX then minX = sp.X end if sp.X > maxX then maxX = sp.X end if sp.Y < minY then minY = sp.Y end if sp.Y > maxY then maxY = sp.Y end end end end end if not visible then hideDrawings(e) return end local centerX = (minX + maxX) / 2 if F.EspBox then if not e.Box then local b = newDrawing("Square") if b then b.Thickness = 1.5 b.Filled = false b.Color = ESP_COLOR end e.Box = b end if e.Box then e.Box.Position = Vector2.new(minX, minY) e.Box.Size = Vector2.new(maxX - minX, maxY - minY) e.Box.Visible = true end elseif e.Box then e.Box.Visible = false end if F.EspLine then if not e.Line then local l = newDrawing("Line") if l then l.Thickness = 1.2 l.Color = ESP_COLOR end e.Line = l end if e.Line then e.Line.From = Vector2.new(cam.ViewportSize.X / 2, 0) e.Line.To = Vector2.new(centerX, maxY) e.Line.Visible = true end elseif e.Line then e.Line.Visible = false end if F.EspName then local txt = ensureText(e, "Name") if txt then txt.Text = t.Model.Name txt.Position = Vector2.new(centerX, minY - 16) txt.Visible = true end elseif e.Name then e.Name.Visible = false end if F.EspDistance then local txt = ensureText(e, "Dist") if txt then txt.Text = string.format("%.0f studs", dist) txt.Position = Vector2.new(centerX, maxY + 2) txt.Visible = true end elseif e.Dist then e.Dist.Visible = false end end function EspEngine.CleanupEntries() for model, e in pairs(EspEngine.Entries) do destroyEntry(e) EspEngine.Entries[model] = nil end end function EspEngine.CleanupItems() for obj, h in pairs(EspEngine.ItemHighlights) do h:Destroy() EspEngine.ItemHighlights[obj] = nil end end function EspEngine.Cleanup() EspEngine.CleanupEntries() EspEngine.CleanupItems() end function EspEngine.Step() local F = StateManager.Flags local anyDraw = F.EspLine or F.EspBox or F.EspName or F.EspDistance if (anyDraw and not hasDrawing and not warnedDrawing) then warnedDrawing = true warn("[QA Menu] Drawing API không khả dụng: Esp 2D bị tắt, Hologram/Workspace vẫn hoạt động.") end local cam = Workspace.CurrentCamera local root = GetRoot() if not (anyDraw or F.EspHologram) or not cam or not root then EspEngine.CleanupEntries() return end local range = StateManager.Config.ScanRange local active = {} for _, t in ipairs(TargetScanner.List) do if t.Model.Parent and t.Humanoid.Parent and t.Humanoid.Health > 0 and t.Root.Parent then local dist = (t.Root.Position - root.Position).Magnitude if dist <= range then active[t.Model] = true local e = EspEngine.Entries[t.Model] if not e then e = {} EspEngine.Entries[t.Model] = e end updateEntry(e, t, cam, root, dist) end end end for model, e in pairs(EspEngine.Entries) do if not active[model] then destroyEntry(e) EspEngine.Entries[model] = nil end end end function EspEngine.UpdateItems() if not StateManager.IsOn("EspWorkspace") then EspEngine.CleanupItems() return end local folder = Workspace:FindFirstChild("Item") local root = GetRoot() if not folder or not root then EspEngine.CleanupItems() return end local range = StateManager.Config.ScanRange local current = {} for _, obj in ipairs(folder:GetChildren()) do local pos if obj:IsA("Model") then pos = obj:GetPivot().Position elseif obj:IsA("BasePart") then pos = obj.Position end if pos and (pos - root.Position).Magnitude <= range then current[obj] = true if not EspEngine.ItemHighlights[obj] then local h = Instance.new("Highlight") h.Name = "QA_ItemHighlight" h.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop h.FillColor = Color3.fromRGB(80, 220, 120) h.FillTransparency = 0.5 h.OutlineColor = Color3.new(1, 1, 1) h.Adornee = obj h.Parent = obj EspEngine.ItemHighlights[obj] = h end end end for obj, h in pairs(EspEngine.ItemHighlights) do if not current[obj] or not obj.Parent then h:Destroy() EspEngine.ItemHighlights[obj] = nil end end end function EspEngine.StepItems(dt) EspEngine._itemAcc += dt if EspEngine._itemAcc >= 0.5 then EspEngine._itemAcc = 0 if StateManager.IsOn("EspWorkspace") then EspEngine.UpdateItems() end end end for _, key in ipairs({ "EspLine", "EspBox", "EspName", "EspDistance", "EspHologram" }) do StateManager.Register(key, nil, function() EspEngine.Step() end) end StateManager.Register("EspWorkspace", function() EspEngine.UpdateItems() end, function() EspEngine.CleanupItems() end) ---------------------------------------------------------------------- -- MovementAndWorld ---------------------------------------------------------------------- local MovementAndWorld = { FlyUp = false, FlyDown = false } local move = { noclipConn = nil, flyBV = nil, flyBG = nil, speedConn = nil, jumpConn = nil, nvConn = nil, nvSnap = nil, nvAcc = 0, lagConn = nil, lagSnap = {}, lagToken = 0, } -- NoClip function MovementAndWorld.EnableNoClip() StateManager.TakeSnapshot("NoClip", {}) move.noclipConn = RunService.Stepped:Connect(function() local char = LocalPlayer.Character local snap = StateManager.Snapshots.NoClip if not char or not snap then return end for _, p in ipairs(char:GetDescendants()) do if p:IsA("BasePart") then if snap[p] == nil then snap[p] = p.CanCollide end p.CanCollide = false end end end) end function MovementAndWorld.DisableNoClip() if move.noclipConn then move.noclipConn:Disconnect() move.noclipConn = nil end local snap = StateManager.PopSnapshot("NoClip") if snap then for part, orig in pairs(snap) do if part.Parent then part.CanCollide = orig end end end end -- Fly function MovementAndWorld.EnableFly() local root, hum = GetRoot(), GetHumanoid() if not root then return end StateManager.TakeSnapshot("Fly", { AutoRotate = hum and hum.AutoRotate }) local bv = Instance.new("BodyVelocity") bv.MaxForce = Vector3.new(1e9, 1e9, 1e9) bv.Velocity = Vector3.zero bv.Parent = root local bg = Instance.new("BodyGyro") bg.MaxTorque = Vector3.new(1e9, 1e9, 1e9) bg.P = 20000 bg.D = 800 bg.CFrame = root.CFrame bg.Parent = root move.flyBV, move.flyBG = bv, bg if hum then hum.AutoRotate = false end end function MovementAndWorld.DisableFly() if move.flyBV then move.flyBV:Destroy() end if move.flyBG then move.flyBG:Destroy() end move.flyBV, move.flyBG = nil, nil MovementAndWorld.FlyUp, MovementAndWorld.FlyDown = false, false local snap = StateManager.PopSnapshot("Fly") local hum = GetHumanoid() if hum and snap and snap.AutoRotate ~= nil then hum.AutoRotate = snap.AutoRotate end local root = GetRoot() if root then root.AssemblyLinearVelocity = Vector3.zero end end function MovementAndWorld.StepFly() if not StateManager.IsOn("Fly") then return end local root, hum, cam = GetRoot(), GetHumanoid(), Workspace.CurrentCamera if not (root and hum and cam and move.flyBV and move.flyBV.Parent and move.flyBG and move.flyBG.Parent) then return end local speed = StateManager.Config.FlySpeed local look = cam.CFrame.LookVector local flatLook = Vector3.new(look.X, 0, look.Z) flatLook = flatLook.Magnitude > 0.001 and flatLook.Unit or Vector3.new(0, 0, -1) local right = cam.CFrame.RightVector local flatRight = Vector3.new(right.X, 0, right.Z) flatRight = flatRight.Magnitude > 0.001 and flatRight.Unit or Vector3.new(1, 0, 0) local md = hum.MoveDirection local vel = Vector3.zero if md.Magnitude > 0.01 then local f = md:Dot(flatLook) local r = md:Dot(flatRight) vel = (look * f + flatRight * r) * speed end if MovementAndWorld.FlyUp then vel += Vector3.new(0, speed, 0) end if MovementAndWorld.FlyDown then vel -= Vector3.new(0, speed, 0) end move.flyBV.Velocity = vel move.flyBG.CFrame = CFrame.lookAt(root.Position, root.Position + flatLook) end -- Speed function MovementAndWorld.EnableSpeed() local hum = GetHumanoid() if hum then StateManager.TakeSnapshot("WalkSpeed", { Value = hum.WalkSpeed }) end move.speedConn = RunService.Heartbeat:Connect(function() local h = GetHumanoid() if h then h.WalkSpeed = StateManager.Config.WalkSpeed end end) end function MovementAndWorld.DisableSpeed() if move.speedConn then move.speedConn:Disconnect() move.speedConn = nil end local snap = StateManager.PopSnapshot("WalkSpeed") local hum = GetHumanoid() if hum and snap then hum.WalkSpeed = snap.Value end end -- Jumping Air function MovementAndWorld.EnableJumpingAir() move.jumpConn = UserInputService.JumpRequest:Connect(function() local hum = GetHumanoid() if hum then hum:ChangeState(Enum.HumanoidStateType.Jumping) end end) end function MovementAndWorld.DisableJumpingAir() if move.jumpConn then move.jumpConn:Disconnect() move.jumpConn = nil end end -- Night Vision local NV_PROPS = { "Brightness", "ClockTime", "Ambient", "OutdoorAmbient", "FogEnd", "FogStart", "FogColor", "ExposureCompensation" } local function applyNightVision() Lighting.Brightness = 3 Lighting.ClockTime = 14 Lighting.Ambient = Color3.new(1, 1, 1) Lighting.OutdoorAmbient = Color3.new(1, 1, 1) Lighting.FogStart = 1e9 Lighting.FogEnd = 1e9 Lighting.ExposureCompensation = 0.5 for _, c in ipairs(Lighting:GetChildren()) do if c:IsA("PostEffect") then c.Enabled = false elseif c:IsA("Atmosphere") then c.Density = 0 c.Haze = 0 end end end function MovementAndWorld.EnableNightVision() local snap = { Props = {}, Post = {}, Atmos = {} } for _, name in ipairs(NV_PROPS) do snap.Props[name] = Lighting[name] end for _, c in ipairs(Lighting:GetChildren()) do if c:IsA("PostEffect") then snap.Post[c] = c.Enabled elseif c:IsA("Atmosphere") then snap.Atmos[c] = { Density = c.Density, Haze = c.Haze } end end StateManager.TakeSnapshot("NightVision", snap) applyNightVision() move.nvAcc = 0 move.nvConn = RunService.Heartbeat:Connect(function(dt) move.nvAcc += dt if move.nvAcc >= 0.5 then move.nvAcc = 0 applyNightVision() end end) end function MovementAndWorld.DisableNightVision() if move.nvConn then move.nvConn:Disconnect() move.nvConn = nil end local snap = StateManager.PopSnapshot("NightVision") if not snap then return end for name, value in pairs(snap.Props) do pcall(function() Lighting[name] = value end) end for effect, enabled in pairs(snap.Post) do if effect.Parent then effect.Enabled = enabled end end for atmos, values in pairs(snap.Atmos) do if atmos.Parent then atmos.Density = values.Density atmos.Haze = values.Haze end end end -- Fix Lag local function applyLag(inst) local snap = move.lagSnap if inst:IsA("BasePart") then if snap[inst] == nil then snap[inst] = { Prop = "CastShadow", Value = inst.CastShadow } end inst.CastShadow = false elseif inst:IsA("ParticleEmitter") or inst:IsA("Trail") or inst:IsA("Beam") or inst:IsA("Fire") or inst:IsA("Smoke") then if snap[inst] == nil then snap[inst] = { Prop = "Enabled", Value = inst.Enabled } end inst.Enabled = false elseif inst:IsA("Decal") then -- gồm cả Texture if snap[inst] == nil then snap[inst] = { Prop = "Transparency", Value = inst.Transparency } end inst.Transparency = 0.85 end end function MovementAndWorld.EnableFixLag() move.lagToken += 1 local token = move.lagToken StateManager.TakeSnapshot("FixLag", { GlobalShadows = Lighting.GlobalShadows }) Lighting.GlobalShadows = false move.lagConn = Workspace.DescendantAdded:Connect(function(inst) pcall(applyLag, inst) end) task.spawn(function() local n = 0 for _, d in ipairs(Workspace:GetDescendants()) do if token ~= move.lagToken then return end pcall(applyLag, d) n += 1 if n % 400 == 0 then task.wait() end end end) end function MovementAndWorld.DisableFixLag() move.lagToken += 1 if move.lagConn then move.lagConn:Disconnect() move.lagConn = nil end local snap = StateManager.PopSnapshot("FixLag") if snap then Lighting.GlobalShadows = snap.GlobalShadows end local old = move.lagSnap move.lagSnap = {} task.spawn(function() local n = 0 for inst, data in pairs(old) do if inst.Parent then pcall(function() inst[data.Prop] = data.Value end) end n += 1 if n % 400 == 0 then task.wait() end end end) end StateManager.Register("NoClip", MovementAndWorld.EnableNoClip, MovementAndWorld.DisableNoClip) StateManager.Register("Fly", MovementAndWorld.EnableFly, MovementAndWorld.DisableFly) StateManager.Register("Speed", MovementAndWorld.EnableSpeed, MovementAndWorld.DisableSpeed) StateManager.Register("JumpingAir", MovementAndWorld.EnableJumpingAir, MovementAndWorld.DisableJumpingAir) StateManager.Register("NightVision", MovementAndWorld.EnableNightVision, MovementAndWorld.DisableNightVision) StateManager.Register("FixLag", MovementAndWorld.EnableFixLag, MovementAndWorld.DisableFixLag) ---------------------------------------------------------------------- -- UIController ---------------------------------------------------------------------- local UIController = {} local COLORS = { Bg = Color3.fromRGB(24, 26, 32), Title = Color3.fromRGB(36, 40, 50), Row = Color3.fromRGB(34, 37, 46), TabOn = Color3.fromRGB(70, 110, 200), TabOff = Color3.fromRGB(44, 48, 60), On = Color3.fromRGB(60, 170, 90), Off = Color3.fromRGB(150, 60, 60), Text = Color3.fromRGB(235, 235, 240), } local function make(class, props, parent) local inst = Instance.new(class) for k, v in pairs(props) do inst[k] = v end inst.Parent = parent return inst end local function corner(parent, radius) return make("UICorner", { CornerRadius = UDim.new(0, radius or 6) }, parent) end function UIController.Build() local playerGui = LocalPlayer:WaitForChild("PlayerGui") local old = playerGui:FindFirstChild("QA_ModularControlMenu") if old then old:Destroy() end local gui = make("ScreenGui", { Name = "QA_ModularControlMenu", ResetOnSpawn = false, ZIndexBehavior = Enum.ZIndexBehavior.Sibling, DisplayOrder = 100, }, playerGui) UIController.Gui = gui local FULL_SIZE = UDim2.new(0, 320, 0, 400) local COLLAPSED_SIZE = UDim2.new(0, 320, 0, 32) local main = make("Frame", { Name = "Main", Size = FULL_SIZE, Position = UDim2.new(0, 20, 0, 60), BackgroundColor3 = COLORS.Bg, BorderSizePixel = 0, ClipsDescendants = true, }, gui) corner(main, 8) local titleBar = make("Frame", { Name = "TitleBar", Size = UDim2.new(1, 0, 0, 32), BackgroundColor3 = COLORS.Title, BorderSizePixel = 0, }, main) make("TextLabel", { Size = UDim2.new(1, -90, 1, 0), Position = UDim2.new(0, 10, 0, 0), BackgroundTransparency = 1, Text = "QA Control Menu • 150 studs", TextColor3 = COLORS.Text, Font = Enum.Font.GothamBold, TextSize = 14, TextXAlignment = Enum.TextXAlignment.Left, }, titleBar) local collapseBtn = make("TextButton", { Size = UDim2.new(0, 30, 0, 22), Position = UDim2.new(1, -72, 0, 5), BackgroundColor3 = COLORS.TabOff, Text = "–", TextColor3 = COLORS.Text, Font = Enum.Font.GothamBold, TextSize = 16, AutoButtonColor = true, }, titleBar) corner(collapseBtn, 5) local closeBtn = make("TextButton", { Size = UDim2.new(0, 30, 0, 22), Position = UDim2.new(1, -38, 0, 5), BackgroundColor3 = COLORS.Off, Text = "X", TextColor3 = COLORS.Text, Font = Enum.Font.GothamBold, TextSize = 14, AutoButtonColor = true, }, titleBar) corner(closeBtn, 5) local body = make("Frame", { Name = "Body", Size = UDim2.new(1, 0, 1, -32), Position = UDim2.new(0, 0, 0, 32), BackgroundTransparency = 1, }, main) local tabBar = make("Frame", { Size = UDim2.new(1, -16, 0, 30), Position = UDim2.new(0, 8, 0, 8), BackgroundTransparency = 1, }, body) make("UIListLayout", { FillDirection = Enum.FillDirection.Horizontal, Padding = UDim.new(0, 6), SortOrder = Enum.SortOrder.LayoutOrder, }, tabBar) local pagesHolder = make("Frame", { Size = UDim2.new(1, -16, 1, -54), Position = UDim2.new(0, 8, 0, 46), BackgroundTransparency = 1, }, body) local pages, tabButtons = {}, {} local toggleButtons = {} local function selectTab(name) for n, page in pairs(pages) do page.Visible = (n == name) tabButtons[n].BackgroundColor3 = (n == name) and COLORS.TabOn or COLORS.TabOff end end local function addTab(name, order) local btn = make("TextButton", { Size = UDim2.new(0, 96, 1, 0), BackgroundColor3 = COLORS.TabOff, Text = name, TextColor3 = COLORS.Text, Font = Enum.Font.GothamBold, TextSize = 13, LayoutOrder = order, }, tabBar) corner(btn, 6) local page = make("ScrollingFrame", { Size = UDim2.new(1, 0, 1, 0), BackgroundTransparency = 1, BorderSizePixel = 0, ScrollBarThickness = 4, CanvasSize = UDim2.new(0, 0, 0, 0), AutomaticCanvasSize = Enum.AutomaticSize.Y, Visible = false, }, pagesHolder) make("UIListLayout", { Padding = UDim.new(0, 5), SortOrder = Enum.SortOrder.LayoutOrder }, page) pages[name], tabButtons[name] = page, btn btn.MouseButton1Click:Connect(function() selectTab(name) end) return page end local function refreshToggle(key) local btn = toggleButtons[key] if btn then local on = StateManager.IsOn(key) btn.Text = on and "ON" or "OFF" btn.BackgroundColor3 = on and COLORS.On or COLORS.Off end end local function addToggle(page, label, key) local row = make("Frame", { Size = UDim2.new(1, -6, 0, 32), BackgroundColor3 = COLORS.Row, BorderSizePixel = 0, }, page) corner(row, 6) make("TextLabel", { Size = UDim2.new(1, -80, 1, 0), Position = UDim2.new(0, 10, 0, 0), BackgroundTransparency = 1, Text = label, TextColor3 = COLORS.Text, Font = Enum.Font.Gotham, TextSize = 13, TextXAlignment = Enum.TextXAlignment.Left, }, row) local btn = make("TextButton", { Size = UDim2.new(0, 56, 0, 22), Position = UDim2.new(1, -64, 0, 5), BackgroundColor3 = COLORS.Off, Text = "OFF", TextColor3 = COLORS.Text, Font = Enum.Font.GothamBold, TextSize = 12, }, row) corner(btn, 5) toggleButtons[key] = btn btn.MouseButton1Click:Connect(function() StateManager.Set(key, not StateManager.IsOn(key)) end) refreshToggle(key) end local function addNumber(page, label, key) local row = make("Frame", { Size = UDim2.new(1, -6, 0, 32), BackgroundColor3 = COLORS.Row, BorderSizePixel = 0, }, page) corner(row, 6) make("TextLabel", { Size = UDim2.new(1, -90, 1, 0), Position = UDim2.new(0, 10, 0, 0), BackgroundTransparency = 1, Text = label, TextColor3 = COLORS.Text, Font = Enum.Font.Gotham, TextSize = 13, TextXAlignment = Enum.TextXAlignment.Left, }, row) local box = make("TextBox", { Size = UDim2.new(0, 70, 0, 22), Position = UDim2.new(1, -78, 0, 5), BackgroundColor3 = COLORS.TabOff, Text = tostring(StateManager.Config[key]), TextColor3 = COLORS.Text, Font = Enum.Font.GothamBold, TextSize = 12, ClearTextOnFocus = false, }, row) corner(box, 5) box.FocusLost:Connect(function() local n = tonumber(box.Text) if n then n = StateManager.SetConfig(key, n) end box.Text = tostring(StateManager.Config[key]) end) end local mainPage = addTab("Main", 1) local espPage = addTab("Esp", 2) local otherPage = addTab("Khác", 3) -- TAB MAIN addToggle(mainPage, "Tele Dron", "TeleDron") addToggle(mainPage, "Tele Kill", "TeleKill") addToggle(mainPage, "Aimbot", "Aimbot") addToggle(mainPage, "Aim Magic", "AimMagic") addToggle(mainPage, "Auto Bắn", "AutoFire") addNumber(mainPage, "Phạm vi (studs)", "ScanRange") addNumber(mainPage, "Độ cao Dron", "DroneHeightOffset") -- TAB ESP addToggle(espPage, "Esp Line", "EspLine") addToggle(espPage, "Esp Box", "EspBox") addToggle(espPage, "Esp Name", "EspName") addToggle(espPage, "Esp Distance", "EspDistance") addToggle(espPage, "Esp Hologram", "EspHologram") addToggle(espPage, "Esp Workspace", "EspWorkspace") -- TAB KHÁC addToggle(otherPage, "No Clip", "NoClip") addToggle(otherPage, "Fly Air", "Fly") addNumber(otherPage, "Fly Speed", "FlySpeed") addToggle(otherPage, "Speed", "Speed") addNumber(otherPage, "Walk Speed", "WalkSpeed") addToggle(otherPage, "Jumping Air", "JumpingAir") addToggle(otherPage, "Night Vision", "NightVision") addToggle(otherPage, "Fix Lag", "FixLag") selectTab("Main") -- Nút bay Lên / Xuống local flyPanel = make("Frame", { Name = "FlyPanel", Size = UDim2.new(0, 110, 0, 110), Position = UDim2.new(1, -130, 0.5, -55), BackgroundTransparency = 1, Visible = false, }, gui) local function addFlyButton(text, yOffset, flagName) local btn = make("TextButton", { Size = UDim2.new(1, 0, 0, 50), Position = UDim2.new(0, 0, 0, yOffset), BackgroundColor3 = COLORS.TabOn, BackgroundTransparency = 0.15, Text = text, TextColor3 = COLORS.Text, Font = Enum.Font.GothamBold, TextSize = 15, AutoButtonColor = false, }, flyPanel) corner(btn, 10) btn.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then MovementAndWorld[flagName] = true end end) btn.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then MovementAndWorld[flagName] = false end end) end addFlyButton("▲ Lên cao", 0, "FlyUp") addFlyButton("▼ Hạ thấp", 60, "FlyDown") StateManager.OnChanged(function(key, value) refreshToggle(key) if key == "Fly" then flyPanel.Visible = value end end) -- Thu gọn / mở rộng local collapsed = false collapseBtn.MouseButton1Click:Connect(function() collapsed = not collapsed body.Visible = not collapsed main.Size = collapsed and COLLAPSED_SIZE or FULL_SIZE collapseBtn.Text = collapsed and "+" or "–" end) closeBtn.MouseButton1Click:Connect(function() if _G.QA_ModularMenuUnload then _G.QA_ModularMenuUnload() end end) -- Kéo thả local dragging, dragStart, startPos = false, nil, nil 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 input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false 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 ---------------------------------------------------------------------- -- Vòng lặp chính & dọn dẹp ---------------------------------------------------------------------- track(RunService.Heartbeat:Connect(function(dt) TargetScanner.Step(dt) CombatEngine.Step(dt) MovementAndWorld.StepFly() EspEngine.StepItems(dt) end)) RunService:BindToRenderStep("QA_Aimbot", Enum.RenderPriority.Camera.Value + 1, function() CombatEngine.StepCamera() end) RunService:BindToRenderStep("QA_Esp", Enum.RenderPriority.Camera.Value + 2, function() EspEngine.Step() end) track(LocalPlayer.CharacterAdded:Connect(function(char) char:WaitForChild("HumanoidRootPart", 10) char:WaitForChild("Humanoid", 10) task.wait(0.1) CombatEngine.Target = nil for _, key in ipairs({ "NoClip", "Fly", "Speed", "TeleDron" }) do if StateManager.IsOn(key) then StateManager.Reapply(key) end end end)) local function Unload() _G.QA_ModularMenuUnload = nil for key in pairs(StateManager.Flags) do StateManager.Set(key, false) end EspEngine.Cleanup() pcall(function() RunService:UnbindFromRenderStep("QA_Aimbot") end) pcall(function() RunService:UnbindFromRenderStep("QA_Esp") end) for _, c in ipairs(Connections) do c:Disconnect() end table.clear(Connections) if UIController.Gui then UIController.Gui:Destroy() end end _G.QA_ModularMenuUnload = Unload UIController.Build()