Skip to content
RoRoScripts
CORZ preview
UnknownUniversal

CORZ

Script
Views
430
Likes
0
Dislikes
0
Added
Script
--[[
    Corz v4.4
    Toggle: RightShift (rebindable) | Close: X
]] 
------------------------------------------------------------------------
-- Services
------------------------------------------------------------------------
local Players          = game:GetService("Players")
local TweenService     = game:GetService("TweenService")
local UserInputService = game:GetService("UserInputService")
local RunService       = game:GetService("RunService")
local ReplicatedStorage= game:GetService("ReplicatedStorage")
local HttpService      = game:GetService("HttpService")
local Lighting         = game:GetService("Lighting")
local TeleportService  = game:GetService("TeleportService")
local VirtualUser      = game:GetService("VirtualUser")

local player    = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local Mouse     = player:GetMouse()
local Camera    = workspace.CurrentCamera

------------------------------------------------------------------------
-- File I/O
------------------------------------------------------------------------
local CONFIG_FILE = "CorzV4_configs.json"
local function fileWrite(data)
    pcall(function() writefile(CONFIG_FILE, HttpService:JSONEncode(data)) end)
end
local function fileRead()
    local ok, res = pcall(function()
        if isfile and not isfile(CONFIG_FILE) then return nil end
        return HttpService:JSONDecode(readfile(CONFIG_FILE))
    end)
    if ok and type(res) == "table" then return res end
    return nil
end

------------------------------------------------------------------------
-- Theme
------------------------------------------------------------------------
local T = {
    bg        = Color3.fromRGB(5,   4,   8),
    sidebar   = Color3.fromRGB(9,   5,  12),
    panel     = Color3.fromRGB(16,  10,  20),
    panelHov  = Color3.fromRGB(30,  14,  32),
    accent    = Color3.fromRGB(220,  25,  55),
    accentBr  = Color3.fromRGB(255,  70, 100),
    text      = Color3.fromRGB(255, 230, 238),
    sub       = Color3.fromRGB(165, 100, 120),
    off       = Color3.fromRGB(38,   18,  32),
    danger    = Color3.fromRGB(255,  35,  35),
    dangerHov = Color3.fromRGB(255,  75,  75),
    wire      = Color3.fromRGB(80,   20,  40),
}
local FONT      = Enum.Font.GothamMedium
local FONT_BOLD = Enum.Font.GothamBold
local menuKey   = Enum.KeyCode.RightShift

------------------------------------------------------------------------
-- Connection registry
------------------------------------------------------------------------
local conns      = {}
local loopTweens = {}
local function track(signal, fn)
    local c = signal:Connect(fn); table.insert(conns, c); return c
end
local function disconnectAll()
    for _, c in ipairs(conns) do if c.Connected then c:Disconnect() end end
    table.clear(conns)
    for _, t in ipairs(loopTweens) do t:Cancel() end
    table.clear(loopTweens)
end

------------------------------------------------------------------------
-- Tween helpers
------------------------------------------------------------------------
local function tw(obj, props, t, style, dir)
    local tween = TweenService:Create(obj,
        TweenInfo.new(t or 0.2, style or Enum.EasingStyle.Quad, dir or Enum.EasingDirection.Out), props)
    tween:Play(); return tween
end
local function twBack(obj, props, t)
    return tw(obj, props, t or 0.35, Enum.EasingStyle.Back, Enum.EasingDirection.Out)
end
local function twSpring(obj, props, t)
    return tw(obj, props, t or 0.45, Enum.EasingStyle.Elastic, Enum.EasingDirection.Out)
end

------------------------------------------------------------------------
-- Instance factory
------------------------------------------------------------------------
local function new(class, props, children)
    local inst = Instance.new(class)
    for k, v in pairs(props or {}) do if k ~= "Parent" then inst[k] = v end end
    for _, child in ipairs(children or {}) do child.Parent = inst end
    if props and props.Parent then inst.Parent = props.Parent end
    return inst
end
local function corner(r) return new("UICorner", { CornerRadius = UDim.new(0, r) }) end
local function pad(t, l, r, b)
    return new("UIPadding", {
        PaddingTop    = UDim.new(0, t or 0),
        PaddingLeft   = UDim.new(0, l or 0),
        PaddingRight  = UDim.new(0, r or 0),
        PaddingBottom = UDim.new(0, b or 0),
    })
end

------------------------------------------------------------------------
-- Corner brackets
------------------------------------------------------------------------
local function makeBrackets(parent, bSize, thick)
    local segs = {}
    local defs = {
        {ap=Vector2.new(0,0),hy=0,          vx=0          },
        {ap=Vector2.new(1,0),hy=0,          vx=bSize-thick},
        {ap=Vector2.new(0,1),hy=bSize-thick,vx=0          },
        {ap=Vector2.new(1,1),hy=bSize-thick,vx=bSize-thick},
    }
    for _, d in ipairs(defs) do
        local g = new("Frame",{AnchorPoint=d.ap,Position=UDim2.new(d.ap.X,0,d.ap.Y,0),
            Size=UDim2.fromOffset(bSize,bSize),BackgroundTransparency=1,Parent=parent})
        new("Frame",{Position=UDim2.fromOffset(0,d.hy),Size=UDim2.fromOffset(bSize,thick),
            BackgroundColor3=T.accent,BackgroundTransparency=0.1,BorderSizePixel=0,Parent=g})
        new("Frame",{Position=UDim2.fromOffset(d.vx,0),Size=UDim2.fromOffset(thick,bSize),
            BackgroundColor3=T.accent,BackgroundTransparency=0.1,BorderSizePixel=0,Parent=g})
        table.insert(segs,g)
    end
    return segs
end

------------------------------------------------------------------------
-- Root ScreenGui
------------------------------------------------------------------------
local gui = new("ScreenGui",{
    Name="CorzV4",ResetOnSpawn=false,
    ZIndexBehavior=Enum.ZIndexBehavior.Sibling,
    IgnoreGuiInset=true,Parent=playerGui,
})

------------------------------------------------------------------------
-- Particles
------------------------------------------------------------------------
local particleHolder = new("Frame",{
    Name="Particles",Size=UDim2.fromScale(1,1),
    BackgroundTransparency=1,Active=false,ZIndex=10,Parent=gui,
})
local activeParticles = 0
local MAX_PARTICLES   = 55
local particlesAlive  = true

do
    local PCOLORS = {
        Color3.fromRGB(220,25,55),Color3.fromRGB(255,70,100),Color3.fromRGB(180,10,30),
        Color3.fromRGB(255,30,60),Color3.fromRGB(12,3,8),Color3.fromRGB(40,0,12),Color3.fromRGB(80,5,20),
    }
    local function spawnMicro()
        if activeParticles>=MAX_PARTICLES then return end; activeParticles+=1
        local sz=math.random(2,4); local color=PCOLORS[math.random(#PCOLORS)]
        local sx=math.random(2,98)/100; local sy=math.random(30,100)/100
        local dur=math.random(25,55)/10; local driftX=math.random(-20,20)/1000
        local p=new("Frame",{Size=UDim2.fromOffset(sz,sz),Position=UDim2.new(sx,0,sy,0),
            BackgroundColor3=color,BackgroundTransparency=1,BorderSizePixel=0,ZIndex=10,Active=false,Parent=particleHolder},{corner(sz)})
        TweenService:Create(p,TweenInfo.new(0.3,Enum.EasingStyle.Quad),{BackgroundTransparency=math.random(10,45)/100}):Play()
        TweenService:Create(p,TweenInfo.new(dur,Enum.EasingStyle.Linear),{Position=UDim2.new(sx+driftX*dur,0,sy-math.random(25,65)/100,0)}):Play()
        task.delay(dur*0.6,function() if p.Parent then TweenService:Create(p,TweenInfo.new(dur*0.4,Enum.EasingStyle.Quad),{BackgroundTransparency=1}):Play() end end)
        task.delay(dur,function() if p.Parent then p:Destroy() end; activeParticles-=1 end)
    end
    local function spawnMid()
        if activeParticles>=MAX_PARTICLES then return end; activeParticles+=1
        local sz=math.random(5,9); local color=PCOLORS[math.random(4)]
        local sx=math.random(1,99)/100; local sy=math.random(20,100)/100
        local dur=math.random(50,90)/10; local driftX=math.random(-15,15)/1000
        local p=new("Frame",{Size=UDim2.fromOffset(sz,sz),Position=UDim2.new(sx,0,sy,0),
            BackgroundColor3=color,BackgroundTransparency=1,BorderSizePixel=0,ZIndex=10,Active=false,Parent=particleHolder},{corner(sz)})
        local pS=Instance.new("UIStroke"); pS.Color=T.accentBr; pS.Transparency=0.3; pS.Thickness=1; pS.Parent=p
        TweenService:Create(p,TweenInfo.new(0.5,Enum.EasingStyle.Quad),{BackgroundTransparency=math.random(60,80)/100}):Play()
        TweenService:Create(p,TweenInfo.new(dur,Enum.EasingStyle.Sine),{Position=UDim2.new(sx+driftX*dur,0,sy-math.random(20,50)/100,0)}):Play()
        task.delay(dur*0.65,function()
            if p.Parent then
                TweenService:Create(p,TweenInfo.new(dur*0.35,Enum.EasingStyle.Quad),{BackgroundTransparency=1}):Play()
                TweenService:Create(pS,TweenInfo.new(dur*0.35,Enum.EasingStyle.Quad),{Transparency=1}):Play()
            end
        end)
        task.delay(dur,function() if p.Parent then p:Destroy() end; activeParticles-=1 end)
    end
    local function spawnOrb()
        if activeParticles>=MAX_PARTICLES then return end; activeParticles+=1
        local sz=math.random(12,22); local color=PCOLORS[math.random(3)]
        local sx=math.random(5,95)/100; local sy=math.random(10,90)/100
        local dur=math.random(80,130)/10; local driftX=math.random(-8,8)/1000
        local p=new("Frame",{Size=UDim2.fromOffset(sz,sz),Position=UDim2.new(sx,0,sy,0),
            BackgroundColor3=color,BackgroundTransparency=1,BorderSizePixel=0,ZIndex=10,Active=false,Parent=particleHolder},{corner(sz)})
        local oS=Instance.new("UIStroke"); oS.Color=color; oS.Transparency=0.5; oS.Thickness=4; oS.Parent=p
        TweenService:Create(p,TweenInfo.new(1.2,Enum.EasingStyle.Sine),{BackgroundTransparency=0.88}):Play()
        TweenService:Create(oS,TweenInfo.new(1.2,Enum.EasingStyle.Sine),{Transparency=0.55}):Play()
        TweenService:Create(p,TweenInfo.new(dur,Enum.EasingStyle.Sine),{Position=UDim2.new(sx+driftX*dur,0,sy-math.random(10,30)/100,0)}):Play()
        local pa=true
        local function pulse()
            if not pa or not p.Parent then return end
            TweenService:Create(oS,TweenInfo.new(1.5,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut),{Transparency=0.2}):Play()
            task.delay(1.5,function()
                if not pa or not p.Parent then return end
                TweenService:Create(oS,TweenInfo.new(1.5,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut),{Transparency=0.65}):Play()
                task.delay(1.5,function() pulse() end)
            end)
        end; pulse()
        task.delay(dur*0.7,function()
            pa=false
            if p.Parent then
                TweenService:Create(p,TweenInfo.new(dur*0.3,Enum.EasingStyle.Quad),{BackgroundTransparency=1}):Play()
                TweenService:Create(oS,TweenInfo.new(dur*0.3,Enum.EasingStyle.Quad),{Transparency=1}):Play()
            end
        end)
        task.delay(dur,function() if p.Parent then p:Destroy() end; activeParticles-=1 end)
    end
    local function spawnSpark()
        activeParticles+=1
        local p=new("Frame",{Size=UDim2.fromOffset(2,2),
            Position=UDim2.new(math.random(3,97)/100,0,math.random(5,95)/100,0),
            BackgroundColor3=Color3.fromRGB(255,120,140),BackgroundTransparency=0,
            BorderSizePixel=0,ZIndex=11,Active=false,Parent=particleHolder},{corner(1)})
        TweenService:Create(p,TweenInfo.new(0.45,Enum.EasingStyle.Quad),{BackgroundTransparency=1,Size=UDim2.fromOffset(1,1)}):Play()
        task.delay(0.5,function() if p.Parent then p:Destroy() end; activeParticles-=1 end)
    end
    task.spawn(function() while gui.Parent and particlesAlive do spawnMicro(); task.wait(math.random(6,14)/100) end end)
    task.spawn(function() task.wait(0.3); while gui.Parent and particlesAlive do spawnMid(); task.wait(math.random(22,45)/100) end end)
    task.spawn(function() task.wait(0.8); while gui.Parent and particlesAlive do spawnOrb(); task.wait(math.random(60,120)/100) end end)
    task.spawn(function() task.wait(1.5); while gui.Parent and particlesAlive do spawnSpark(); task.wait(math.random(18,60)/100) end end)
end

------------------------------------------------------------------------
-- Radar overlay
------------------------------------------------------------------------
local RADAR_SIZE  = 160
local RADAR_RANGE = 300
local radarHolder = new("Frame",{
    Name="Radar",Size=UDim2.fromOffset(RADAR_SIZE,RADAR_SIZE),
    AnchorPoint=Vector2.new(0,1),Position=UDim2.new(0,12,1,-12),
    BackgroundColor3=Color3.fromRGB(6,3,10),BackgroundTransparency=0.25,
    BorderSizePixel=0,Visible=false,ZIndex=20,Parent=gui,
},{corner(RADAR_SIZE//2)})
do
    local rs=Instance.new("UIStroke"); rs.Color=T.accent; rs.Transparency=0.4; rs.Thickness=1; rs.Parent=radarHolder
    new("Frame",{Size=UDim2.fromOffset(6,6),AnchorPoint=Vector2.new(0.5,0.5),
        Position=UDim2.fromScale(0.5,0.5),BackgroundColor3=T.text,BorderSizePixel=0,ZIndex=21,Parent=radarHolder},{corner(3)})
    new("TextLabel",{Text="N",Font=FONT_BOLD,TextSize=9,TextColor3=T.accent,
        BackgroundTransparency=1,Size=UDim2.fromOffset(14,12),
        AnchorPoint=Vector2.new(0.5,0),Position=UDim2.new(0.5,0,0,4),ZIndex=21,Parent=radarHolder})
end
local radarDots={}

------------------------------------------------------------------------
-- Fake Lag state
------------------------------------------------------------------------
local fakeLagFreezing = false
local fakeLagFlushing = false
local remoteQueue     = {}
local fakeLagEnabled  = false
local fakeLagFreezeMs = 500
local fakeLagSendMs   = 80

local function flushRemoteQueue()
    if #remoteQueue==0 then return end
    local q=remoteQueue; remoteQueue={}
    fakeLagFlushing=true
    for _,entry in ipairs(q) do pcall(function() entry.remote:FireServer(table.unpack(entry.args)) end) end
    fakeLagFlushing=false
end
local function setSimRadius(v)
    pcall(function() sethiddenproperty(player,"SimulationRadius",v) end)
end

------------------------------------------------------------------------
-- Silent Aim config
------------------------------------------------------------------------
local CFG={
    SilentEnabled=false,TargetPart="Head",HitChance=100,MaxDistance=2500,
    WallbangEnabled=false,WallCheck=false,FOVEnabled=false,FOVVisible=false,
    FOVRadius=200,IndicatorEnabled=true,SmoothEnabled=false,SmoothFactor=5,
    TargetPriority="Cursor",HitNotif=false,
}
local CurrentTarget = nil
local RED           = Color3.fromRGB(220,25,55)
local smoothedDir   = nil

local WeaponAction=nil
pcall(function()
    local r=ReplicatedStorage:WaitForChild("Remotes",3)
    if r then WeaponAction=r:WaitForChild("WeaponAction",3) end
end)

------------------------------------------------------------------------
-- Unified __namecall hook
------------------------------------------------------------------------
if hookmetamethod and getrawmetatable then
    pcall(function()
        local oldNamecall
        oldNamecall=hookmetamethod(game,"__namecall",newcclosure(function(self,...)
            local method=getnamecallmethod(); local args={...}
            if fakeLagFreezing and not fakeLagFlushing and method=="FireServer" then
                table.insert(remoteQueue,{remote=self,args=args}); return
            end
            if method=="FireServer" and self==WeaponAction then
                if CFG.SilentEnabled and CurrentTarget and math.random(1,100)<=CFG.HitChance then
                    local action=args[1]
                    if action=="Shoot" and type(args[2])=="table" then
                        local data=args[2]
                        if typeof(data.origin)=="Vector3" and typeof(data.dir)=="Vector3" then
                            data.dir=CFG.SmoothEnabled and smoothedDir or (CurrentTarget.Part.Position-data.origin).Unit
                            args[2]=data
                        end
                    end
                end
            end
            return oldNamecall(self,table.unpack(args))
        end))
    end)
else
    track(UserInputService.InputBegan,function(input,gpe)
        if gpe then return end
        if input.UserInputType==Enum.UserInputType.MouseButton1 then
            if CFG.SilentEnabled and CurrentTarget and math.random(1,100)<=CFG.HitChance then
                local orig=Camera.CFrame
                Camera.CFrame=CFG.SmoothEnabled
                    and orig:Lerp(CFrame.lookAt(orig.Position,CurrentTarget.Part.Position),(CFG.SmoothFactor/10))
                    or CFrame.lookAt(orig.Position,CurrentTarget.Part.Position)
                task.defer(function() Camera.CFrame=orig end)
            end
        end
    end)
end

------------------------------------------------------------------------
-- Fake Lag HUD
------------------------------------------------------------------------
local fakeLagHUD=new("Frame",{
    Name="FakeLagHUD",Size=UDim2.fromOffset(210,50),
    AnchorPoint=Vector2.new(0.5,0),Position=UDim2.new(0.5,0,0,54),
    BackgroundColor3=Color3.fromRGB(6,2,10),BackgroundTransparency=0.2,
    BorderSizePixel=0,Visible=false,ZIndex=25,Parent=gui,
},{corner(8)})
local flHUDStroke=Instance.new("UIStroke")
flHUDStroke.Color=Color3.fromRGB(220,25,55); flHUDStroke.Thickness=1.2; flHUDStroke.Transparency=0.2; flHUDStroke.Parent=fakeLagHUD
new("Frame",{Size=UDim2.new(0,3,1,0),BackgroundColor3=Color3.fromRGB(220,25,55),BorderSizePixel=0,Parent=fakeLagHUD})
new("TextLabel",{Text="⚡ FAKE LAG ACTIVE",Font=FONT_BOLD,TextSize=13,TextColor3=Color3.fromRGB(255,80,100),
    TextXAlignment=Enum.TextXAlignment.Left,BackgroundTransparency=1,Position=UDim2.fromOffset(12,5),
    Size=UDim2.new(1,-16,0,18),ZIndex=26,Parent=fakeLagHUD})
local flStatusLbl=new("TextLabel",{Text="Initialising…",Font=FONT_BOLD,TextSize=11,
    TextColor3=Color3.fromRGB(100,255,130),TextXAlignment=Enum.TextXAlignment.Left,
    BackgroundTransparency=1,Position=UDim2.fromOffset(12,26),Size=UDim2.new(1,-32,0,14),ZIndex=26,Parent=fakeLagHUD})
local flDot=new("Frame",{Size=UDim2.fromOffset(6,6),AnchorPoint=Vector2.new(1,0.5),
    Position=UDim2.new(1,-10,0.5,0),BackgroundColor3=Color3.fromRGB(255,60,60),
    BorderSizePixel=0,ZIndex=26,Parent=fakeLagHUD},{corner(3)})
local flDotTween

local function stopFakeLag()
    fakeLagEnabled=false; fakeLagFreezing=false
    flushRemoteQueue(); setSimRadius(1000)
    fakeLagHUD.Visible=false
    if flDotTween then flDotTween:Cancel() end
end
local function startFakeLag()
    if fakeLagEnabled then return end
    fakeLagEnabled=true; fakeLagHUD.Visible=true
    if flDotTween then flDotTween:Cancel() end
    flDotTween=TweenService:Create(flDot,TweenInfo.new(0.5,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,-1,true),{BackgroundTransparency=0.8})
    flDotTween:Play()
    task.spawn(function()
        while fakeLagEnabled and gui.Parent do
            fakeLagFreezing=true; setSimRadius(0)
            flStatusLbl.Text="Holding packets…"; flStatusLbl.TextColor3=Color3.fromRGB(255,80,80)
            flHUDStroke.Color=Color3.fromRGB(255,60,60)
            task.wait(fakeLagFreezeMs/1000)
            if not fakeLagEnabled then break end
            fakeLagFreezing=false; setSimRadius(1000)
            local count=#remoteQueue
            flStatusLbl.Text=("Flushing %d packet%s…"):format(count,count==1 and "" or "s")
            flStatusLbl.TextColor3=Color3.fromRGB(100,255,130); flHUDStroke.Color=Color3.fromRGB(220,25,55)
            flushRemoteQueue()
            task.wait(fakeLagSendMs/1000)
        end
        fakeLagFreezing=false; flushRemoteQueue(); setSimRadius(1000)
    end)
end

------------------------------------------------------------------------
-- Toast
------------------------------------------------------------------------
local toastHolder=new("Frame",{Name="Toasts",AnchorPoint=Vector2.new(1,0),
    Position=UDim2.new(1,-16,0,16),Size=UDim2.fromOffset(300,600),
    BackgroundTransparency=1,Parent=gui,},{
    new("UIListLayout",{Padding=UDim.new(0,8),SortOrder=Enum.SortOrder.LayoutOrder,
        HorizontalAlignment=Enum.HorizontalAlignment.Right,VerticalAlignment=Enum.VerticalAlignment.Top}),
})
local toastIdx=0
local function notify(title,body,duration)
    duration=duration or 3; toastIdx+=1
    local slot=new("Frame",{Size=UDim2.fromOffset(300,68),BackgroundTransparency=1,LayoutOrder=toastIdx,Parent=toastHolder})
    local card=new("Frame",{Size=UDim2.fromOffset(0,68),AnchorPoint=Vector2.new(1,0),
        BackgroundColor3=T.panel,BorderSizePixel=0,ClipsDescendants=true,Parent=slot},{corner(10)})
    local s=Instance.new("UIStroke"); s.Color=T.accent; s.Transparency=0.3; s.Thickness=1; s.Parent=card
    new("Frame",{Size=UDim2.new(0,3,1,0),BackgroundColor3=T.accent,BorderSizePixel=0,Parent=card})
    new("TextLabel",{Text=title or "",Font=FONT_BOLD,TextSize=13,TextColor3=T.text,
        TextXAlignment=Enum.TextXAlignment.Left,TextTruncate=Enum.TextTruncate.AtEnd,
        BackgroundTransparency=1,Position=UDim2.fromOffset(14,7),Size=UDim2.new(1,-26,0,20),Parent=card})
    new("TextLabel",{Text=body or "",Font=FONT,TextSize=12,TextColor3=T.sub,
        TextXAlignment=Enum.TextXAlignment.Left,TextTruncate=Enum.TextTruncate.AtEnd,
        BackgroundTransparency=1,Position=UDim2.fromOffset(14,30),Size=UDim2.new(1,-26,0,18),Parent=card})
    local bar=new("Frame",{Size=UDim2.new(1,0,0,3),Position=UDim2.new(0,0,1,-3),BackgroundColor3=T.accent,BorderSizePixel=0,Parent=card})
    TweenService:Create(card,TweenInfo.new(0.4,Enum.EasingStyle.Back,Enum.EasingDirection.Out),{Size=UDim2.fromOffset(300,68)}):Play()
    TweenService:Create(bar,TweenInfo.new(duration,Enum.EasingStyle.Linear),{Size=UDim2.new(0,0,0,3)}):Play()
    task.delay(duration,function()
        if not slot.Parent then return end
        local out=tw(card,{Size=UDim2.fromOffset(0,68)},0.28); out.Completed:Wait()
        if not slot.Parent then return end
        local col=tw(slot,{Size=UDim2.fromOffset(300,0)},0.18); col.Completed:Wait()
        if slot.Parent then slot:Destroy() end
    end)
end

------------------------------------------------------------------------
-- Main window
------------------------------------------------------------------------
local window=new("Frame",{Name="Window",Size=UDim2.fromOffset(600,390),
    Position=UDim2.fromScale(0.5,0.5),AnchorPoint=Vector2.new(0.5,0.5),
    BackgroundColor3=T.bg,BorderSizePixel=0,ClipsDescendants=false,Parent=gui},{corner(6)})
local glowFrame=new("Frame",{Size=UDim2.new(1,16,1,16),Position=UDim2.new(0,-8,0,-8),
    BackgroundTransparency=1,BorderSizePixel=0,ZIndex=0,Parent=window})
local glowStroke=Instance.new("UIStroke"); glowStroke.Color=T.accent; glowStroke.Transparency=0.6; glowStroke.Thickness=3; glowStroke.Parent=glowFrame
new("UICorner",{CornerRadius=UDim.new(0,10),Parent=glowFrame})
local winStroke=Instance.new("UIStroke"); winStroke.Color=T.accent; winStroke.Transparency=0.45; winStroke.Thickness=1; winStroke.Parent=window
local brackets=makeBrackets(window,18,2)
local uiScale=new("UIScale",{Scale=1,Parent=window})
local innerClip=new("Frame",{Size=UDim2.fromScale(1,1),BackgroundTransparency=1,ClipsDescendants=true,Parent=window})

------------------------------------------------------------------------
-- Title bar
------------------------------------------------------------------------
local titleBar=new("Frame",{Size=UDim2.new(1,0,0,46),BackgroundColor3=T.sidebar,BorderSizePixel=0,Parent=innerClip},{corner(6)})
new("UIGradient",{
    Color=ColorSequence.new({ColorSequenceKeypoint.new(0,T.accent),ColorSequenceKeypoint.new(0.5,Color3.fromRGB(160,10,35)),ColorSequenceKeypoint.new(1,T.sidebar)}),
    Transparency=NumberSequence.new({NumberSequenceKeypoint.new(0,0.72),NumberSequenceKeypoint.new(0.5,0.85),NumberSequenceKeypoint.new(1,1)}),
    Parent=titleBar})
local scanLine=new("Frame",{Name="ScanLine",Size=UDim2.fromOffset(3,46),Position=UDim2.new(-0.05,0,0,0),
    BackgroundColor3=Color3.fromRGB(255,255,255),BackgroundTransparency=0.75,BorderSizePixel=0,ZIndex=6,Parent=titleBar})
new("UIGradient",{Transparency=NumberSequence.new({NumberSequenceKeypoint.new(0,1),NumberSequenceKeypoint.new(0.5,0),NumberSequenceKeypoint.new(1,1)}),Rotation=90,Parent=scanLine})
new("Frame",{Size=UDim2.new(1,0,0,1),Position=UDim2.new(0,0,1,-1),BackgroundColor3=T.accent,BackgroundTransparency=0.5,BorderSizePixel=0,Parent=titleBar})
local statusDot=new("Frame",{Size=UDim2.fromOffset(6,6),AnchorPoint=Vector2.new(0,0.5),
    Position=UDim2.new(0,14,0.5,0),BackgroundColor3=T.accent,BorderSizePixel=0,Parent=titleBar},{corner(3)})
new("TextLabel",{Text="CORZ  V4.4",Font=FONT_BOLD,TextSize=16,TextColor3=T.text,
    TextXAlignment=Enum.TextXAlignment.Left,BackgroundTransparency=1,
    Position=UDim2.fromOffset(28,0),Size=UDim2.new(1,-80,1,0),Parent=titleBar})
local closeBtn=new("TextButton",{Text="✕",Font=FONT_BOLD,TextSize=13,TextColor3=T.text,
    BackgroundColor3=T.danger,BackgroundTransparency=0.5,AutoButtonColor=false,
    Size=UDim2.fromOffset(26,26),AnchorPoint=Vector2.new(1,0.5),
    Position=UDim2.new(1,-10,0.5,0),Parent=titleBar},{corner(4)})
track(closeBtn.MouseEnter,function() tw(closeBtn,{BackgroundTransparency=0},0.15) end)
track(closeBtn.MouseLeave,function() tw(closeBtn,{BackgroundTransparency=0.5},0.15) end)

-- Drag
do
    local dragging,dragStart,startPos
    track(titleBar.InputBegan,function(input)
        if input.UserInputType==Enum.UserInputType.MouseButton1
        or input.UserInputType==Enum.UserInputType.Touch then
            dragging=true; dragStart=input.Position; startPos=window.Position
            input.Changed:Connect(function()
                if input.UserInputState==Enum.UserInputState.End then dragging=false end
            end)
        end
    end)
    track(UserInputService.InputChanged,function(input)
        if dragging and (input.UserInputType==Enum.UserInputType.MouseMovement
        or input.UserInputType==Enum.UserInputType.Touch) then
            local d=input.Position-dragStart
            window.Position=UDim2.new(startPos.X.Scale,startPos.X.Offset+d.X,startPos.Y.Scale,startPos.Y.Offset+d.Y)
        end
    end)
end

-- Ambient
do
    local t1=TweenService:Create(winStroke,TweenInfo.new(2.2,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,-1,true),{Transparency=0.1}); t1:Play(); table.insert(loopTweens,t1)
    local t2=TweenService:Create(glowStroke,TweenInfo.new(2.2,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,-1,true),{Transparency=0.2}); t2:Play(); table.insert(loopTweens,t2)
    local t3=TweenService:Create(statusDot,TweenInfo.new(1.4,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,-1,true),{BackgroundTransparency=0.6}); t3:Play(); table.insert(loopTweens,t3)
    for _,b in ipairs(brackets) do
        for _,seg in ipairs(b:GetChildren()) do
            if seg:IsA("Frame") then
                local t=TweenService:Create(seg,TweenInfo.new(2.8,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,-1,true),{BackgroundTransparency=0.65})
                t:Play(); table.insert(loopTweens,t)
            end
        end
    end
    local function runScan()
        scanLine.Position=UDim2.new(-0.05,0,0,0)
        local t=TweenService:Create(scanLine,TweenInfo.new(2.6,Enum.EasingStyle.Linear),{Position=UDim2.new(1.05,0,0,0)})
        t:Play(); t.Completed:Connect(function() task.wait(1.4); if gui.Parent then runScan() end end)
    end
    runScan()
end

------------------------------------------------------------------------
-- Open / close
------------------------------------------------------------------------
local isOpen=true
local function setOpen(open)
    isOpen=open
    if open then
        window.Visible=true; particleHolder.Visible=true; uiScale.Scale=0.78
        twBack(uiScale,{Scale=1},0.4)
    else
        particleHolder.Visible=false
        local t=tw(uiScale,{Scale=0.78},0.18)
        t.Completed:Connect(function() if not isOpen then window.Visible=false end end)
    end
end
track(closeBtn.MouseButton1Click,function() setOpen(false) end)
track(UserInputService.InputBegan,function(input,processed)
    if not processed and input.KeyCode==menuKey then setOpen(not isOpen) end
end)

------------------------------------------------------------------------
-- Sidebar + content
------------------------------------------------------------------------
local SIDEBAR_W=150
local sidebar=new("Frame",{Size=UDim2.new(0,SIDEBAR_W,1,-46),Position=UDim2.fromOffset(0,46),
    BackgroundColor3=T.sidebar,BorderSizePixel=0,Parent=innerClip},{
    new("UIListLayout",{Padding=UDim.new(0,4),SortOrder=Enum.SortOrder.LayoutOrder}),pad(10,7,7,10)})
new("Frame",{Size=UDim2.new(0,1,1,-46),Position=UDim2.new(0,SIDEBAR_W,0,46),
    BackgroundColor3=T.accent,BackgroundTransparency=0.7,BorderSizePixel=0,Parent=innerClip})
local content=new("Frame",{Size=UDim2.new(1,-SIDEBAR_W,1,-46),Position=UDim2.new(0,SIDEBAR_W,0,46),
    BackgroundTransparency=1,ClipsDescendants=true,Parent=innerClip})

------------------------------------------------------------------------
-- Tab system
------------------------------------------------------------------------
local pages={} local tabBtns={} local tabOrders={} local currentTab
local tabIndicator=new("Frame",{Size=UDim2.fromOffset(3,32),Position=UDim2.fromOffset(0,10),
    BackgroundColor3=T.accent,BorderSizePixel=0,ZIndex=4,Parent=sidebar},{corner(2)})
do local ig=Instance.new("UIStroke"); ig.Color=T.accentBr; ig.Transparency=0.3; ig.Thickness=2; ig.Parent=tabIndicator end
local TAB_H=32; local TAB_PAD=4; local TAB_TOP=10
local function getTabY(order) return TAB_TOP+(order-1)*(TAB_H+TAB_PAD) end
local function selectTab(name)
    currentTab=name
    twBack(tabIndicator,{Position=UDim2.fromOffset(0,getTabY(tabOrders[name] or 1))},0.3)
    for n,page in pairs(pages) do
        local active=(n==name); page.Visible=active
        if active then page.Position=UDim2.fromOffset(0,20); tw(page,{Position=UDim2.fromOffset(0,0)},0.3) end
    end
    for n,btn in pairs(tabBtns) do
        local active=(n==name)
        tw(btn,{BackgroundColor3=active and T.accent or T.panel,TextColor3=active and T.text or T.sub},0.2)
        local s=btn:FindFirstChildOfClass("UIStroke"); if s then tw(s,{Transparency=active and 0.4 or 1},0.2) end
    end
end
local function addTab(name,order)
    tabOrders[name]=order
    local btn=new("TextButton",{Text=name,Font=FONT,TextSize=11,TextColor3=T.sub,
        BackgroundColor3=T.panel,AutoButtonColor=false,Size=UDim2.new(1,0,0,TAB_H),LayoutOrder=order,Parent=sidebar},{corner(6)})
    local bStroke=Instance.new("UIStroke"); bStroke.Color=T.accent; bStroke.Transparency=1; bStroke.Thickness=1; bStroke.Parent=btn
    local page=new("ScrollingFrame",{Size=UDim2.fromScale(1,1),BackgroundTransparency=1,BorderSizePixel=0,
        ScrollBarThickness=2,ScrollBarImageColor3=T.accent,CanvasSize=UDim2.new(),
        AutomaticCanvasSize=Enum.AutomaticSize.Y,Visible=false,Parent=content},{
        new("UIListLayout",{Padding=UDim.new(0,7),SortOrder=Enum.SortOrder.LayoutOrder}),pad(12,13,13,12)})
    pages[name]=page; tabBtns[name]=btn
    track(btn.MouseEnter,function()
        if currentTab~=name then tw(btn,{BackgroundColor3=T.panelHov},0.12); tw(bStroke,{Transparency=0.7},0.12) end
    end)
    track(btn.MouseLeave,function()
        if currentTab~=name then tw(btn,{BackgroundColor3=T.panel},0.12); tw(bStroke,{Transparency=1},0.12) end
    end)
    track(btn.MouseButton1Click,function() selectTab(name) end)
    return page
end

------------------------------------------------------------------------
-- Controls registry
------------------------------------------------------------------------
local controls={}

------------------------------------------------------------------------
-- Component library
------------------------------------------------------------------------
local function makeRow(parent,h,order)
    local row=new("Frame",{Size=UDim2.new(1,0,0,h or 44),BackgroundColor3=T.panel,
        BorderSizePixel=0,LayoutOrder=order,Parent=parent},{corner(8)})
    local ab=new("Frame",{Size=UDim2.new(0,2,1,-10),Position=UDim2.fromOffset(5,5),
        BackgroundColor3=T.accent,BackgroundTransparency=1,BorderSizePixel=0,Parent=row},{corner(1)})
    track(row.MouseEnter,function() tw(row,{BackgroundColor3=T.panelHov},0.12); tw(ab,{BackgroundTransparency=0},0.12) end)
    track(row.MouseLeave,function() tw(row,{BackgroundColor3=T.panel},0.12); tw(ab,{BackgroundTransparency=1},0.12) end)
    return row
end
local function makeLabel(parent,text,size,color,font)
    return new("TextLabel",{Text=text or "",Font=font or FONT,TextSize=size or 14,
        TextColor3=color or T.text,TextXAlignment=Enum.TextXAlignment.Left,
        BackgroundTransparency=1,Position=UDim2.fromOffset(14,0),Size=UDim2.new(1,-80,1,0),Parent=parent})
end
local function makeInfoRow(parent,text,order)
    local row=new("Frame",{Size=UDim2.new(1,0,0,30),BackgroundColor3=T.panel,
        BorderSizePixel=0,LayoutOrder=order,Parent=parent},{corner(8)})
    local lbl=makeLabel(row,text,11,T.sub); lbl.Size=UDim2.new(1,-24,1,0)
    new("Frame",{Size=UDim2.fromOffset(2,14),Position=UDim2.fromOffset(5,8),
        BackgroundColor3=T.accent,BackgroundTransparency=0.6,BorderSizePixel=0,Parent=row},{corner(1)})
    return row
end
local function makeSectionHeader(parent,text,order)
    local row=new("Frame",{Size=UDim2.new(1,0,0,28),BackgroundTransparency=1,LayoutOrder=order,Parent=parent})
    new("TextLabel",{Text=text:upper(),Font=FONT_BOLD,TextSize=10,TextColor3=T.accent,
        TextXAlignment=Enum.TextXAlignment.Left,BackgroundTransparency=1,
        Position=UDim2.fromOffset(14,0),Size=UDim2.new(1,-24,1,0),Parent=row})
    new("Frame",{Size=UDim2.new(1,-14,0,1),Position=UDim2.new(0,14,1,-1),
        BackgroundColor3=T.accent,BackgroundTransparency=0.7,BorderSizePixel=0,Parent=row})
    return row
end
local function makeToggle(parent,text,default,callback,key,order)
    local row=makeRow(parent,44,order); makeLabel(row,text)
    local tr=new("TextButton",{Text="",AutoButtonColor=false,Size=UDim2.fromOffset(46,24),
        AnchorPoint=Vector2.new(1,0.5),Position=UDim2.new(1,-12,0.5,0),BackgroundColor3=T.off,Parent=row},{corner(12)})
    local tS=Instance.new("UIStroke"); tS.Color=T.accent; tS.Transparency=0.8; tS.Thickness=1; tS.Parent=tr
    local knob=new("Frame",{Size=UDim2.fromOffset(18,18),AnchorPoint=Vector2.new(0,0.5),
        Position=UDim2.new(0,3,0.5,0),BackgroundColor3=T.sub,Parent=tr},{corner(9)})
    local state=not not default
    local function render(animate)
        local t=animate and 0.22 or 0
        tw(tr,{BackgroundColor3=state and T.accent or T.off},t)
        tw(tS,{Transparency=state and 0.5 or 0.8},t)
        tw(knob,{Position=state and UDim2.new(1,-21,0.5,0) or UDim2.new(0,3,0.5,0),BackgroundColor3=state and T.text or T.sub},t)
        if animate and state then
            tw(knob,{Size=UDim2.fromOffset(20,20)},0.1)
            task.delay(0.1,function() if knob.Parent then twSpring(knob,{Size=UDim2.fromOffset(18,18)},0.3) end end)
        end
    end
    render(false)
    track(tr.MouseButton1Click,function()
        state=not state; render(true); callback(state)
        notify(text,state and "Enabled" or "Disabled",2)
    end)
    if key then
        controls[key]={
            get=function() return state end,
            set=function(v) local b=not not v; if b==state then return end; state=b; render(true); callback(state) end,
        }
    end
end
local function makeSlider(parent,text,min_,max_,default,callback,key,order)
    local row=makeRow(parent,60,order)
    local lbl=makeLabel(row,text,12,T.sub); lbl.Position=UDim2.fromOffset(14,-8)
    local valLbl=new("TextLabel",{Text=tostring(default),Font=FONT_BOLD,TextSize=12,TextColor3=T.accent,
        TextXAlignment=Enum.TextXAlignment.Right,BackgroundTransparency=1,
        AnchorPoint=Vector2.new(1,0),Position=UDim2.new(1,-12,0,8),Size=UDim2.fromOffset(52,16),Parent=row})
    local trackBar=new("Frame",{Size=UDim2.new(1,-26,0,4),Position=UDim2.new(0,13,1,-14),
        BackgroundColor3=T.off,BorderSizePixel=0,Parent=row},{corner(2)})
    local trkS=Instance.new("UIStroke"); trkS.Color=T.wire; trkS.Transparency=0; trkS.Thickness=1; trkS.Parent=trackBar
    local fill=new("Frame",{Size=UDim2.fromScale((default-min_)/(max_-min_),1),BackgroundColor3=T.accent,BorderSizePixel=0,Parent=trackBar},
        {corner(2),new("UIGradient",{Color=ColorSequence.new(T.accent,T.accentBr)})})
    local knob=new("Frame",{Size=UDim2.fromOffset(10,10),AnchorPoint=Vector2.new(0.5,0.5),
        Position=UDim2.fromScale((default-min_)/(max_-min_),0.5),BackgroundColor3=T.accentBr,ZIndex=2,Parent=trackBar},{corner(5)})
    local kS=Instance.new("UIStroke"); kS.Color=T.accent; kS.Transparency=0.4; kS.Thickness=2; kS.Parent=knob
    local dragging=false
    local function update(x)
        local alpha=math.clamp((x-trackBar.AbsolutePosition.X)/trackBar.AbsoluteSize.X,0,1)
        local value=math.floor(min_+(max_-min_)*alpha+0.5)
        fill.Size=UDim2.fromScale(alpha,1); knob.Position=UDim2.fromScale(alpha,0.5)
        valLbl.Text=tostring(value); callback(value)
    end
    track(trackBar.InputBegan,function(input)
        if input.UserInputType==Enum.UserInputType.MouseButton1 or input.UserInputType==Enum.UserInputType.Touch then
            dragging=true; twBack(knob,{Size=UDim2.fromOffset(14,14)},0.2); update(input.Position.X)
        end
    end)
    track(UserInputService.InputEnded,function(input)
        if input.UserInputType==Enum.UserInputType.MouseButton1 or input.UserInputType==Enum.UserInputType.Touch then
            if dragging then twBack(knob,{Size=UDim2.fromOffset(10,10)},0.25) end; dragging=false
        end
    end)
    track(UserInputService.InputChanged,function(input)
        if dragging and (input.UserInputType==Enum.UserInputType.MouseMovement or input.UserInputType==Enum.UserInputType.Touch) then
            update(input.Position.X)
        end
    end)
    if key then
        controls[key]={
            get=function() return tonumber(valLbl.Text) end,
            set=function(v)
                v=math.clamp(math.floor(v+0.5),min_,max_)
                local alpha=(v-min_)/(max_-min_)
                fill.Size=UDim2.fromScale(alpha,1); knob.Position=UDim2.fromScale(alpha,0.5); valLbl.Text=tostring(v); callback(v)
            end,
        }
    end
end
local function makeKeybind(parent,text,default,callback,key,order)
    local currentKey=default or Enum.KeyCode.Unknown; local listening=false
    local row=makeRow(parent,44,order); makeLabel(row,text)
    local bindBtn=new("TextButton",{Text=currentKey==Enum.KeyCode.Unknown and "NONE" or currentKey.Name,
        Font=FONT_BOLD,TextSize=11,TextColor3=T.accent,BackgroundColor3=T.off,AutoButtonColor=false,
        Size=UDim2.fromOffset(90,26),AnchorPoint=Vector2.new(1,0.5),Position=UDim2.new(1,-12,0.5,0),Parent=row},{corner(5)})
    local bS=Instance.new("UIStroke"); bS.Color=T.accent; bS.Transparency=0.5; bS.Thickness=1; bS.Parent=bindBtn
    local function setKey(newKey)
        currentKey=newKey; bindBtn.Text=newKey==Enum.KeyCode.Unknown and "NONE" or newKey.Name; listening=false
        tw(bindBtn,{BackgroundColor3=T.off,TextColor3=T.accent},0.15); tw(bS,{Transparency=0.5},0.15)
        if callback then callback(newKey) end
    end
    track(bindBtn.MouseButton1Click,function()
        if listening then setKey(Enum.KeyCode.Unknown); return end
        listening=true; bindBtn.Text="..."
        tw(bindBtn,{BackgroundColor3=T.accent,TextColor3=T.text},0.15); tw(bS,{Transparency=0.1},0.15)
    end)
    track(bindBtn.MouseEnter,function() if not listening then tw(bindBtn,{BackgroundColor3=T.panelHov},0.12) end end)
    track(bindBtn.MouseLeave,function() if not listening then tw(bindBtn,{BackgroundColor3=T.off},0.12) end end)
    track(UserInputService.InputBegan,function(input,gpe)
        if not listening then return end
        if input.UserInputType~=Enum.UserInputType.Keyboard then return end
        if input.KeyCode==Enum.KeyCode.Escape then setKey(Enum.KeyCode.Unknown); return end
        setKey(input.KeyCode)
    end)
    if key then
        controls[key]={
            get=function() return currentKey.Name end,
            set=function(v) local ok,kc=pcall(function() return Enum.KeyCode[v] end); if ok and kc then setKey(kc) end end,
        }
    end
end
local function makeDropdown(parent,text,options,default,callback,key,order)
    local selected=default or (options[1] or ""); local ddOpen=false
    local container=new("Frame",{Size=UDim2.new(1,0,0,0),AutomaticSize=Enum.AutomaticSize.Y,
        BackgroundTransparency=1,LayoutOrder=order,Parent=parent},
        {new("UIListLayout",{Padding=UDim.new(0,3),SortOrder=Enum.SortOrder.LayoutOrder})})
    local row=makeRow(container,44,1); makeLabel(row,text)
    local dropBtn=new("TextButton",{Text=selected.."  ▾",Font=FONT,TextSize=11,TextColor3=T.accent,
        BackgroundColor3=T.off,AutoButtonColor=false,Size=UDim2.fromOffset(118,24),
        AnchorPoint=Vector2.new(1,0.5),Position=UDim2.new(1,-12,0.5,0),Parent=row},{corner(5)})
    local dS=Instance.new("UIStroke"); dS.Color=T.accent; dS.Transparency=0.5; dS.Thickness=1; dS.Parent=dropBtn
    local optPanel=new("Frame",{Size=UDim2.new(1,0,0,0),AutomaticSize=Enum.AutomaticSize.Y,
        BackgroundColor3=T.panel,BorderSizePixel=0,LayoutOrder=2,Visible=false,Parent=container},{corner(8),pad(4,4,4,4)})
    local opS=Instance.new("UIStroke"); opS.Color=T.accent; opS.Transparency=0.5; opS.Thickness=1; opS.Parent=optPanel
    new("UIListLayout",{Padding=UDim.new(0,3),SortOrder=Enum.SortOrder.LayoutOrder,Parent=optPanel})
    for _,opt in ipairs(options) do
        local optBtn=new("TextButton",{Text=tostring(opt),Font=FONT,TextSize=12,TextColor3=T.text,
            BackgroundColor3=T.panel,AutoButtonColor=false,Size=UDim2.new(1,0,0,30),Parent=optPanel},{corner(6)})
        track(optBtn.MouseEnter,function() tw(optBtn,{BackgroundColor3=T.panelHov},0.1) end)
        track(optBtn.MouseLeave,function() tw(optBtn,{BackgroundColor3=(opt==selected) and T.accent or T.panel},0.1) end)
        track(optBtn.MouseButton1Click,function()
            for _,ch in ipairs(optPanel:GetChildren()) do if ch:IsA("TextButton") then tw(ch,{BackgroundColor3=T.panel},0.1) end end
            selected=opt; tw(optBtn,{BackgroundColor3=T.accent},0.1)
            dropBtn.Text=selected.."  ▾"; ddOpen=false; optPanel.Visible=false
            if callback then callback(selected) end
        end)
    end
    track(dropBtn.MouseButton1Click,function()
        ddOpen=not ddOpen; optPanel.Visible=ddOpen; dropBtn.Text=selected..(ddOpen and "  ▴" or "  ▾")
    end)
    if key then
        controls[key]={
            get=function() return selected end,
            set=function(v) selected=v; dropBtn.Text=v.."  ▾"; if callback then callback(v) end end,
        }
    end
end
local function makeActionRow(parent,text,btnLabel,callback,order)
    local row=makeRow(parent,44,order); makeLabel(row,text)
    local btn=new("TextButton",{Text=btnLabel,Font=FONT_BOLD,TextSize=11,TextColor3=T.text,
        BackgroundColor3=T.accent,AutoButtonColor=false,Size=UDim2.fromOffset(80,26),
        AnchorPoint=Vector2.new(1,0.5),Position=UDim2.new(1,-12,0.5,0),Parent=row},{corner(5)})
    track(btn.MouseEnter,function() tw(btn,{BackgroundColor3=T.accentBr},0.12) end)
    track(btn.MouseLeave,function() tw(btn,{BackgroundColor3=T.accent},0.12) end)
    track(btn.MouseButton1Click,callback)
    return row
end

------------------------------------------------------------------------
-- Pages
------------------------------------------------------------------------
local homePage     = addTab("Home",       1)
local settingsPage = addTab("Settings",   2)
local aimPage      = addTab("Silent Aim", 3)
local espPage      = addTab("ESP",        4)
local movePage     = addTab("Movement",   5)
local utilPage     = addTab("Utility",    6)
local configsPage  = addTab("Configs",    7)
local panicPage    = addTab("Panic",      8)

------------------------------------------------------------------------
-- Home
------------------------------------------------------------------------
do
    local welcome=makeRow(homePage,80,1)
    local n=makeLabel(welcome,"Welcome, "..player.DisplayName,16,T.text,FONT_BOLD); n.Position=UDim2.fromOffset(14,-14)
    local ul=new("Frame",{Size=UDim2.fromOffset(0,1),Position=UDim2.fromOffset(14,28),BackgroundColor3=T.accent,BorderSizePixel=0,Parent=welcome})
    task.delay(0.3,function() twBack(ul,{Size=UDim2.fromOffset(160,1)},0.5) end)
    local h=makeLabel(welcome,"RightShift (rebindable) to toggle  ·  v4.4",11,T.sub); h.Position=UDim2.fromOffset(14,18)
    local statRow=makeRow(homePage,36,2)
    makeLabel(statRow,"Aim · ESP · Fly · Noclip · TP Kill · Fake Lag · Utility",11,T.sub)
    local dot2=new("Frame",{Size=UDim2.fromOffset(6,6),AnchorPoint=Vector2.new(1,0.5),
        Position=UDim2.new(1,-12,0.5,0),BackgroundColor3=T.accent,BorderSizePixel=0,Parent=statRow},{corner(3)})
    local t=TweenService:Create(dot2,TweenInfo.new(1.2,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,-1,true),{BackgroundTransparency=0.7})
    t:Play(); table.insert(loopTweens,t)
end

------------------------------------------------------------------------
-- Settings
------------------------------------------------------------------------
local origFov
local origAmbient,origOutdoorAmbient,origBrightness,origClockTime,origFogEnd,origFogStart
do
    origAmbient=Lighting.Ambient; origOutdoorAmbient=Lighting.OutdoorAmbient
    origBrightness=Lighting.Brightness; origClockTime=Lighting.ClockTime
    origFogEnd=Lighting.FogEnd; origFogStart=Lighting.FogStart
    makeSectionHeader(settingsPage,"Interface",1)
    makeKeybind(settingsPage,"Menu Toggle Key",Enum.KeyCode.RightShift,function(newKey) menuKey=newKey end,"menuKey",2)
    makeSlider(settingsPage,"GUI Opacity",10,100,100,function(v) window.BackgroundTransparency=1-(v/100) end,"guiOpacity",3)
    makeSectionHeader(settingsPage,"Visuals",4)
    makeToggle(settingsPage,"Fullbright",false,function(v)
        if v then Lighting.Ambient=Color3.fromRGB(255,255,255); Lighting.OutdoorAmbient=Color3.fromRGB(255,255,255); Lighting.Brightness=10; Lighting.ClockTime=14
        else Lighting.Ambient=origAmbient; Lighting.OutdoorAmbient=origOutdoorAmbient; Lighting.Brightness=origBrightness; Lighting.ClockTime=origClockTime end
    end,"fullbright",5)
    makeToggle(settingsPage,"No Fog",false,function(v)
        if v then Lighting.FogEnd=1e6; Lighting.FogStart=1e6
        else Lighting.FogEnd=origFogEnd; Lighting.FogStart=origFogStart end
    end,"noFog",6)
    makeSlider(settingsPage,"Brightness",0,10,5,function(v) Lighting.Brightness=v end,"brightness",7)
    makeSlider(settingsPage,"Time of Day",0,24,math.floor(origClockTime),function(v) Lighting.ClockTime=v end,"timeOfDay",8)
    makeSectionHeader(settingsPage,"Camera",9)
    origFov=(workspace.CurrentCamera and workspace.CurrentCamera.FieldOfView) or 70
    makeSlider(settingsPage,"Field of View",40,120,70,function(v)
        local cam=workspace.CurrentCamera; if cam then cam.FieldOfView=v end
    end,"fov",10)
    makeSectionHeader(settingsPage,"HUD",11)
    local fpsLabel=new("TextLabel",{Name="FPSCounter",Text="FPS: --",Font=FONT_BOLD,TextSize=12,
        TextColor3=T.accent,BackgroundColor3=T.bg,BackgroundTransparency=0.15,
        AnchorPoint=Vector2.new(0.5,0),Position=UDim2.new(0.5,0,0,8),
        Size=UDim2.fromOffset(84,24),Visible=false,Parent=gui},{corner(6)})
    local fpsSt=Instance.new("UIStroke"); fpsSt.Color=T.accent; fpsSt.Transparency=0.4; fpsSt.Thickness=1; fpsSt.Parent=fpsLabel
    local fpsConn
    local function setFps(enabled)
        fpsLabel.Visible=enabled
        if fpsConn then fpsConn:Disconnect(); fpsConn=nil end
        if not enabled then return end
        local frames,last=0,os.clock()
        fpsConn=track(RunService.RenderStepped,function()
            frames+=1; local now=os.clock()
            if now-last>=0.5 then fpsLabel.Text=("FPS: %d"):format(math.floor(frames/(now-last)+0.5)); frames=0; last=now end
        end)
    end
    makeToggle(settingsPage,"Show FPS",false,setFps,"showFps",12)
end

------------------------------------------------------------------------
-- Silent Aim
------------------------------------------------------------------------
local indicatorFrame
local FOVCircle
do
    pcall(function()
        if Drawing and Drawing.new then
            FOVCircle=Drawing.new("Circle"); FOVCircle.Visible=false; FOVCircle.Radius=CFG.FOVRadius
            FOVCircle.Color=RED; FOVCircle.Thickness=1.5; FOVCircle.Filled=false; FOVCircle.Transparency=0.55; FOVCircle.NumSides=64
        end
    end)
    local function IsEnemy(character)
        if not character or character==player.Character then return false end
        return character:FindFirstChild("TR_EnemyOutline")~=nil or character:FindFirstChild("TR_EnemyOutline",true)~=nil
    end
    local function IsVisible(targetPart,character)
        if CFG.WallbangEnabled then return true end; if not CFG.WallCheck then return true end
        local origin=Camera.CFrame.Position; local direction=targetPart.Position-origin
        local params=RaycastParams.new(); params.FilterType=Enum.RaycastFilterType.Exclude
        local ignore={player.Character,character,Camera}
        local fxF=workspace:FindFirstChild("FX"); if fxF then table.insert(ignore,fxF) end
        local prF=workspace:FindFirstChild("Projectiles"); if prF then table.insert(ignore,prF) end
        params.FilterDescendantsInstances=ignore
        return workspace:Raycast(origin,direction,params)==nil
    end
    local function ResolvePartName()
        if CFG.TargetPart=="Random" then local o={"Head","HumanoidRootPart","UpperTorso"}; return o[math.random(#o)] end
        return CFG.TargetPart
    end
    local function GetClosestTarget()
        local bestDist=CFG.TargetPriority=="Cursor" and CFG.FOVRadius or math.huge; local best=nil
        local mPos=Vector2.new(Mouse.X,Mouse.Y)
        local myChar=player.Character; local myRoot=myChar and myChar:FindFirstChild("HumanoidRootPart")
        if not myRoot then return nil end
        local candidates={}
        for _,p in pairs(Players:GetPlayers()) do if p~=player and p.Character then table.insert(candidates,{char=p.Character,player=p}) end end
        for _,m in pairs(workspace:GetChildren()) do
            if m:IsA("Model") and m~=myChar and not Players:GetPlayerFromCharacter(m) then
                if m:FindFirstChild("TR_EnemyOutline") or m:FindFirstChild("TR_EnemyOutline",true) then table.insert(candidates,{char=m,player=nil}) end
            end
        end
        for _,c in pairs(candidates) do
            local char=c.char
            if IsEnemy(char) then
                local hum=char:FindFirstChildOfClass("Humanoid")
                if hum and hum.Health>0 then
                    local partName=ResolvePartName()
                    local part=char:FindFirstChild(partName) or char:FindFirstChild("Head") or char:FindFirstChild("HumanoidRootPart")
                    if part and part:IsA("BasePart") then
                        local dist3D=(part.Position-myRoot.Position).Magnitude
                        if dist3D<=CFG.MaxDistance then
                            local sPos,onScreen=Camera:WorldToViewportPoint(part.Position)
                            if onScreen then
                                local metric=CFG.TargetPriority=="Distance" and dist3D or (Vector2.new(sPos.X,sPos.Y)-mPos).Magnitude
                                if metric<bestDist and IsVisible(part,char) then
                                    bestDist=metric
                                    best={Player=c.player,Character=char,Part=part,PartName=partName,ScreenPos=sPos,Distance=math.floor(dist3D)}
                                end
                            end
                        end
                    end
                end
            end
        end
        return best
    end
    indicatorFrame=new("Frame",{Name="IndFrame",AnchorPoint=Vector2.new(0,0.5),
        Position=UDim2.new(0.5,48,0.5,0),Size=UDim2.fromOffset(0,56),
        BackgroundColor3=Color3.fromRGB(8,4,8),BackgroundTransparency=0.3,
        BorderSizePixel=0,Visible=false,Parent=gui},{corner(6)})
    local indStroke=Instance.new("UIStroke"); indStroke.Color=RED; indStroke.Thickness=1.2; indStroke.Transparency=0.15; indStroke.Parent=indicatorFrame
    new("Frame",{Size=UDim2.new(0,3,1,0),BackgroundColor3=RED,BorderSizePixel=0,Parent=indicatorFrame})
    local indName=new("TextLabel",{AnchorPoint=Vector2.new(0,0),Position=UDim2.new(0,11,0,5),Size=UDim2.new(1,-22,0,20),
        BackgroundTransparency=1,Font=FONT_BOLD,TextSize=14,TextColor3=Color3.fromRGB(255,80,80),
        TextStrokeTransparency=0.4,TextStrokeColor3=Color3.new(0,0,0),TextXAlignment=Enum.TextXAlignment.Left,Text="",Parent=indicatorFrame})
    local indInfo=new("TextLabel",{AnchorPoint=Vector2.new(0,0),Position=UDim2.new(0,11,0,28),Size=UDim2.new(1,-22,0,18),
        BackgroundTransparency=1,Font=FONT,TextSize=11,TextColor3=Color3.fromRGB(220,140,150),
        TextStrokeTransparency=0.5,TextStrokeColor3=Color3.new(0,0,0),TextXAlignment=Enum.TextXAlignment.Left,Text="",Parent=indicatorFrame})
    local indDot=new("Frame",{AnchorPoint=Vector2.new(0.5,0.5),Position=UDim2.new(0.5,24,0.5,0),
        Size=UDim2.fromOffset(5,5),BackgroundColor3=RED,BorderSizePixel=0,Visible=false,Parent=gui},{corner(3)})
    local indVisible=false; local indDotTween
    local function startIndDotPulse()
        if indDotTween then indDotTween:Cancel() end
        indDotTween=TweenService:Create(indDot,TweenInfo.new(0.7,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,-1,true),{BackgroundTransparency=0.6})
        indDotTween:Play()
    end
    track(RunService.RenderStepped,function()
        Camera=workspace.CurrentCamera
        CurrentTarget=CFG.SilentEnabled and GetClosestTarget() or nil
        if CFG.SmoothEnabled and CurrentTarget then
            local d=(CurrentTarget.Part.Position-Camera.CFrame.Position).Unit
            smoothedDir=smoothedDir and smoothedDir:Lerp(d,(CFG.SmoothFactor/100)*2) or d
        else smoothedDir=nil end
        if FOVCircle then FOVCircle.Position=Vector2.new(Mouse.X,Mouse.Y+36); FOVCircle.Radius=CFG.FOVRadius; FOVCircle.Visible=CFG.FOVEnabled and CFG.FOVVisible end
        if CFG.IndicatorEnabled and CurrentTarget then
            local name=CurrentTarget.Player and CurrentTarget.Player.Name or CurrentTarget.Character.Name
            indName.Text="▶  "..name; indInfo.Text="  "..CurrentTarget.PartName.."  ·  "..tostring(CurrentTarget.Distance).."m"
            if not indVisible then
                indVisible=true; indicatorFrame.Size=UDim2.fromOffset(0,56); indicatorFrame.Visible=true; indDot.Visible=true
                twBack(indicatorFrame,{Size=UDim2.fromOffset(210,56)},0.3); startIndDotPulse()
            end
            indStroke.Color=(CFG.WallbangEnabled and CFG.WallCheck) and Color3.fromRGB(255,140,40) or RED
        else
            if indVisible then
                indVisible=false; tw(indicatorFrame,{Size=UDim2.fromOffset(0,56)},0.2)
                task.delay(0.2,function()
                    if not indVisible then indicatorFrame.Visible=false; indDot.Visible=false; if indDotTween then indDotTween:Cancel() end end
                end)
            end
        end
    end)
    makeSectionHeader(aimPage,"Silent Aim",1)
    makeToggle(aimPage,"Silent Aim Enabled",false,function(v) CFG.SilentEnabled=v end,"silentEnabled",2)
    makeSlider(aimPage,"Hit Chance %",1,100,100,function(v) CFG.HitChance=v end,"hitChance",3)
    makeSlider(aimPage,"Max Distance",100,5000,2500,function(v) CFG.MaxDistance=v end,"maxDist",4)
    makeDropdown(aimPage,"Target Part",{"Head","HumanoidRootPart","UpperTorso","Random"},"Head",function(v) CFG.TargetPart=v end,"targetPart",5)
    makeDropdown(aimPage,"Target Priority",{"Cursor","Distance"},"Cursor",function(v) CFG.TargetPriority=v end,"targetPriority",6)
    makeSectionHeader(aimPage,"Smoothing",7)
    makeToggle(aimPage,"Smooth Aim",false,function(v) CFG.SmoothEnabled=v end,"smoothEnabled",8)
    makeSlider(aimPage,"Smooth Factor",1,20,5,function(v) CFG.SmoothFactor=v end,"smoothFactor",9)
    makeSectionHeader(aimPage,"FOV",10)
    makeToggle(aimPage,"FOV Circle",false,function(v) CFG.FOVVisible=v; CFG.FOVEnabled=v end,"fovCircle",11)
    makeSlider(aimPage,"FOV Radius",50,500,200,function(v) CFG.FOVRadius=v end,"fovRadius",12)
    makeSectionHeader(aimPage,"Misc",13)
    makeToggle(aimPage,"Hit Notification",false,function(v) CFG.HitNotif=v end,"hitNotif",14)
    makeToggle(aimPage,"Target Indicator",true,function(v)
        CFG.IndicatorEnabled=v; if not v then indicatorFrame.Visible=false; indDot.Visible=false; indVisible=false end
    end,"indicator",15)
    makeSectionHeader(aimPage,"Wallbang",16)
    makeToggle(aimPage,"Wallbang  (Shoot Through Walls)",false,function(v)
        CFG.WallbangEnabled=v; if v then CFG.WallCheck=false end; notify("Wallbang",v and "ON" or "OFF",2)
    end,"wallbang",17)
    makeToggle(aimPage,"Wall Check  (Visible Only)",false,function(v)
        CFG.WallCheck=v; if v then CFG.WallbangEnabled=false end
    end,"wallCheck",18)
    makeInfoRow(aimPage,"Wallbang and Wall Check are mutually exclusive.",19)
end

------------------------------------------------------------------------
-- ESP
------------------------------------------------------------------------
local ESP={names=false,boxes=false,skeleton=false,tracers=false,distance=false,healthBar=false}
local boxHolder    = new("Frame",{Name="BoxHolder",   Size=UDim2.fromScale(1,1),BackgroundTransparency=1,Parent=gui})
local skelHolder   = new("Frame",{Name="SkelHolder",  Size=UDim2.fromScale(1,1),BackgroundTransparency=1,Parent=gui})
local tracerHolder = new("Frame",{Name="TracerHolder",Size=UDim2.fromScale(1,1),BackgroundTransparency=1,Parent=gui})
local hpBarHolder  = new("Frame",{Name="HpBarHolder", Size=UDim2.fromScale(1,1),BackgroundTransparency=1,Parent=gui})
local ESPFolder    = Instance.new("Folder"); ESPFolder.Name="CorzESP"
local espObjects   = {}
local refreshESP
local clearESPObj

do
    local ok=pcall(function() ESPFolder.Parent=game:GetService("CoreGui") end)
    if not ok or not ESPFolder.Parent then ESPFolder.Parent=playerGui end
    local BOX_PARTS={"Head","UpperTorso","LowerTorso","LeftUpperArm","LeftLowerArm","LeftHand","RightUpperArm","RightLowerArm","RightHand","LeftUpperLeg","LeftLowerLeg","LeftFoot","RightUpperLeg","RightLowerLeg","RightFoot"}
    local SKELETON_PAIRS={{"Head","UpperTorso"},{"UpperTorso","LowerTorso"},{"LowerTorso","LeftUpperLeg"},{"LeftUpperLeg","LeftLowerLeg"},{"LeftLowerLeg","LeftFoot"},{"LowerTorso","RightUpperLeg"},{"RightUpperLeg","RightLowerLeg"},{"RightLowerLeg","RightFoot"},{"UpperTorso","LeftUpperArm"},{"LeftUpperArm","LeftLowerArm"},{"UpperTorso","RightUpperArm"},{"RightUpperArm","RightLowerArm"}}
    local function worldToScreen(pos)
        local cam=workspace.CurrentCamera; if not cam then return Vector2.new(),false end
        local sp,vis=cam:WorldToViewportPoint(pos); return Vector2.new(sp.X,sp.Y),vis and sp.Z>0
    end
    local function drawSegment(frame,pA,pB)
        local sA,visA=worldToScreen(pA); local sB,visB=worldToScreen(pB)
        if not(visA or visB) then frame.Visible=false; return end
        local delta=sB-sA; local length=delta.Magnitude
        if length<1 then frame.Visible=false; return end
        local mid=(sA+sB)*0.5
        frame.Position=UDim2.fromOffset(mid.X,mid.Y-length*0.5); frame.Size=UDim2.fromOffset(1,length)
        frame.Rotation=math.deg(math.atan2(delta.Y,delta.X))+90; frame.Visible=true
    end
    clearESPObj=function(o)
        if not o then return end
        if o.nameTag  and o.nameTag.Parent  then o.nameTag:Destroy()  end
        if o.box      and o.box.Parent      then o.box:Destroy()      end
        if o.tracer   and o.tracer.Parent   then o.tracer:Destroy()   end
        if o.hpBar    and o.hpBar.Parent    then o.hpBar:Destroy()    end
        if o.skelLines then for _,e in ipairs(o.skelLines) do if e.seg and e.seg.Parent then e.seg:Destroy() end end end
        if o.healthConn then o.healthConn:Disconnect() end
    end
    local function buildNameTag(plr,head,hum)
        local bb=new("BillboardGui",{Name=plr.Name.."_ESP",Adornee=head,
            Size=UDim2.fromOffset(180,42),StudsOffset=Vector3.new(0,3.2,0),AlwaysOnTop=true,Parent=ESPFolder})
        local lbl=new("TextLabel",{Size=UDim2.new(1,0,0,22),BackgroundTransparency=1,
            TextColor3=Color3.fromRGB(255,75,95),TextStrokeTransparency=0.3,TextStrokeColor3=Color3.new(0,0,0),
            TextSize=13,Font=FONT_BOLD,Text="[ "..plr.Name.." ]  "..math.floor(hum.Health).." HP",Parent=bb})
        local distLbl=new("TextLabel",{Size=UDim2.new(1,0,0,16),Position=UDim2.fromOffset(0,24),
            BackgroundTransparency=1,TextColor3=Color3.fromRGB(200,140,155),TextSize=11,Font=FONT,Text="",Visible=ESP.distance,Parent=bb})
        local conn=hum.HealthChanged:Connect(function(hp)
            if lbl.Parent then lbl.Text="[ "..plr.Name.." ]  "..math.floor(hp).." HP" end
        end)
        return bb,conn,lbl,distLbl,hum
    end
    local function buildBox()
        local frame=new("Frame",{AnchorPoint=Vector2.new(0,0),BackgroundTransparency=1,
            BorderSizePixel=0,Size=UDim2.fromOffset(1,1),Visible=false,Parent=boxHolder})
        local s=Instance.new("UIStroke"); s.Color=RED; s.Thickness=1.5; s.Transparency=0; s.Parent=frame; return frame
    end
    local function buildHpBar()
        local bar=new("Frame",{Size=UDim2.fromOffset(4,1),BackgroundColor3=Color3.fromRGB(20,10,20),
            BorderSizePixel=0,Visible=false,Parent=hpBarHolder},{corner(2)})
        local fill=new("Frame",{Size=UDim2.fromScale(1,1),AnchorPoint=Vector2.new(0,1),
            Position=UDim2.fromScale(0,1),BackgroundColor3=Color3.fromRGB(80,220,80),BorderSizePixel=0,Parent=bar},{corner(2)})
        return bar,fill
    end
    local function buildTracer()
        return new("Frame",{AnchorPoint=Vector2.new(0.5,0),BackgroundColor3=RED,
            BorderSizePixel=0,Size=UDim2.fromOffset(1,0),Visible=false,Parent=tracerHolder})
    end
    local function buildSkeleton(char)
        local lines={}
        for i,pair in ipairs(SKELETON_PAIRS) do
            local pA=char:FindFirstChild(pair[1]); local pB=char:FindFirstChild(pair[2])
            if pA and pB then
                local seg=new("Frame",{Name="Skel_"..i,AnchorPoint=Vector2.new(0.5,0),
                    BackgroundColor3=RED,BorderSizePixel=0,Size=UDim2.fromOffset(1,0),Visible=false,Parent=skelHolder})
                table.insert(lines,{seg=seg,a=pair[1],b=pair[2]})
            end
        end
        return lines
    end
    local function applyESPToChar(plr,character)
        if not character then return end
        task.spawn(function()
            local head=character:WaitForChild("Head",5); local hum=character:WaitForChild("Humanoid",5)
            if not head or not hum then return end
            local waited=0
            while waited<10 do
                if character:FindFirstChild("TR_EnemyOutline") or character:FindFirstChild("TR_EnemyOutline",true) then break end
                task.wait(0.5); waited+=0.5
            end
            if not(character:FindFirstChild("TR_EnemyOutline") or character:FindFirstChild("TR_EnemyOutline",true)) then return end
            clearESPObj(espObjects[plr])
            local o={}
            if ESP.names    then o.nameTag,o.healthConn,o.nameLbl,o.distLbl,o.hum=buildNameTag(plr,head,hum) end
            if ESP.boxes    then o.box=buildBox() end
            if ESP.skeleton then o.skelLines=buildSkeleton(character) end
            if ESP.tracers  then o.tracer=buildTracer() end
            if ESP.healthBar then if not o.hum then o.hum=hum end; o.hpBar,o.hpFill=buildHpBar() end
            espObjects[plr]=o
            character.Destroying:Connect(function() clearESPObj(espObjects[plr]); espObjects[plr]=nil end)
        end)
    end
    refreshESP=function()
        for plr,o in pairs(espObjects) do clearESPObj(o); espObjects[plr]=nil end
        for _,plr in ipairs(Players:GetPlayers()) do
            if plr~=player and plr.Character then applyESPToChar(plr,plr.Character) end
        end
    end
    track(RunService.RenderStepped,function()
        local myChar=player.Character; local myRoot=myChar and myChar:FindFirstChild("HumanoidRootPart")
        for plr,o in pairs(espObjects) do
            local char=plr.Character; if not char then continue end
            if o.box then
                local minX,minY=math.huge,math.huge; local maxX,maxY=-math.huge,-math.huge; local any=false
                for _,partName in ipairs(BOX_PARTS) do
                    local part=char:FindFirstChild(partName)
                    if part and part:IsA("BasePart") then
                        local sp,vis=worldToScreen(part.Position)
                        if vis then any=true
                            if sp.X<minX then minX=sp.X end; if sp.Y<minY then minY=sp.Y end
                            if sp.X>maxX then maxX=sp.X end; if sp.Y>maxY then maxY=sp.Y end
                        end
                    end
                end
                if any then
                    local PAD=4
                    o.box.Position=UDim2.fromOffset(minX-PAD,minY-PAD)
                    o.box.Size=UDim2.fromOffset(maxX-minX+PAD*2,maxY-minY+PAD*2); o.box.Visible=true
                    if o.hpBar and o.hum then
                        local hp=o.hum.Health; local maxHp=o.hum.MaxHealth
                        local pct=maxHp>0 and math.clamp(hp/maxHp,0,1) or 0
                        local r=math.floor((1-pct)*220); local g=math.floor(pct*220)
                        o.hpFill.BackgroundColor3=Color3.fromRGB(r,g,30)
                        o.hpFill.Size=UDim2.fromScale(1,pct); o.hpFill.Position=UDim2.fromScale(0,1-pct)
                        o.hpBar.Position=UDim2.fromOffset(minX-PAD-7,minY-PAD)
                        o.hpBar.Size=UDim2.fromOffset(4,maxY-minY+PAD*2); o.hpBar.Visible=true
                    end
                else o.box.Visible=false; if o.hpBar then o.hpBar.Visible=false end end
            end
            if o.skelLines then
                for _,entry in ipairs(o.skelLines) do
                    local pA=char:FindFirstChild(entry.a); local pB=char:FindFirstChild(entry.b)
                    if pA and pB then drawSegment(entry.seg,pA.Position,pB.Position) else entry.seg.Visible=false end
                end
            end
            if o.tracer then
                local root=char:FindFirstChild("HumanoidRootPart")
                if root then
                    local sp,vis=worldToScreen(root.Position)
                    if vis then
                        local cam=workspace.CurrentCamera
                        local fromPt=Vector2.new(cam.ViewportSize.X/2,cam.ViewportSize.Y)
                        local delta=sp-fromPt; local length=delta.Magnitude
                        if length>1 then
                            local mid=(fromPt+sp)/2
                            o.tracer.Position=UDim2.fromOffset(mid.X,mid.Y-length/2)
                            o.tracer.Size=UDim2.fromOffset(1,length)
                            o.tracer.Rotation=math.deg(math.atan2(delta.Y,delta.X))+90
                            o.tracer.Visible=true
                        else o.tracer.Visible=false end
                    else o.tracer.Visible=false end
                else o.tracer.Visible=false end
            end
            if o.distLbl and ESP.distance and myRoot then
                local root=char:FindFirstChild("HumanoidRootPart")
                if root then o.distLbl.Text=tostring(math.floor((root.Position-myRoot.Position).Magnitude)).." studs"; o.distLbl.Visible=true end
            elseif o.distLbl then o.distLbl.Visible=false end
        end
    end)
    local function trackESPPlayer(plr)
        if plr==player then return end
        track(plr.CharacterAdded,function(char) task.wait(0.15); applyESPToChar(plr,char) end)
        if plr.Character then applyESPToChar(plr,plr.Character) end
    end
    for _,plr in ipairs(Players:GetPlayers()) do trackESPPlayer(plr) end
    track(Players.PlayerAdded,trackESPPlayer)
    track(Players.PlayerRemoving,function(plr) clearESPObj(espObjects[plr]); espObjects[plr]=nil end)
    makeSectionHeader(espPage,"Visual ESP",1)
    makeToggle(espPage,"Names + HP",false,function(v) ESP.names=v;    refreshESP() end,"espNames",   2)
    makeToggle(espPage,"Boxes",     false,function(v) ESP.boxes=v;    refreshESP() end,"espBoxes",   3)
    makeToggle(espPage,"Skeleton",  false,function(v) ESP.skeleton=v; refreshESP() end,"espSkeleton",4)
    makeToggle(espPage,"Tracers",   false,function(v) ESP.tracers=v;  refreshESP() end,"espTracers", 5)
    makeToggle(espPage,"Distance",  false,function(v) ESP.distance=v  end,"espDist",    6)
    makeToggle(espPage,"Health Bars",false,function(v) ESP.healthBar=v; refreshESP() end,"espHpBar", 7)
    makeInfoRow(espPage,"Detected via TR_EnemyOutline tag.",8)
end

------------------------------------------------------------------------
-- Movement + TP Kill + Fake Lag
------------------------------------------------------------------------
local MOVE={walkSpeed=16,jumpPower=50,speedDirty=false,jumpDirty=false,origSpeed=nil,origJump=nil}
local flying        = false; local flyConn=nil; local flyParts={}
local flyKey        = Enum.KeyCode.Unknown
local noclipEnabled = false; local noclipConn=nil
local noclipKey     = Enum.KeyCode.Unknown
local infJumpEnabled= false
local antiVoidEnabled=false; local lastSafePos=Vector3.new(0,100,0); local lastVoidNotify=0
local tpKillEnabled = false; local tpKillKey=Enum.KeyCode.Unknown
local tpKillCooldown= false; local tpKillDelay=150
local getHumanoid
local stopFly
local stopNoclip

do
    getHumanoid=function()
        local char=player.Character; return char and char:FindFirstChildOfClass("Humanoid")
    end
    local function applyMovement()
        local hum=getHumanoid(); if not hum then return end
        if MOVE.speedDirty then hum.WalkSpeed=MOVE.walkSpeed end
        if MOVE.jumpDirty  then if not hum.UseJumpPower then hum.UseJumpPower=true end; hum.JumpPower=MOVE.jumpPower end
    end
    track(RunService.Heartbeat,function()
        applyMovement()
        if antiVoidEnabled then
            local char=player.Character; local hrp=char and char:FindFirstChild("HumanoidRootPart")
            if hrp then
                if hrp.Position.Y>-100 then lastSafePos=hrp.Position
                else
                    hrp.CFrame=CFrame.new(lastSafePos+Vector3.new(0,10,0))
                    local now=os.clock(); if now-lastVoidNotify>3 then lastVoidNotify=now; notify("Anti-Void","Teleported to safety",2) end
                end
            end
        end
    end)
    local function hookHumanoid(char)
        local hum=char:WaitForChild("Humanoid",5); if not hum then return end
        MOVE.origSpeed=MOVE.origSpeed or hum.WalkSpeed; MOVE.origJump=MOVE.origJump or hum.JumpPower
        applyMovement()
    end
    if player.Character then task.spawn(hookHumanoid,player.Character) end
    track(player.CharacterAdded,hookHumanoid)
    track(UserInputService.JumpRequest,function()
        if not infJumpEnabled then return end
        local hum=getHumanoid(); if hum then hum:ChangeState(Enum.HumanoidStateType.Jumping) end
    end)
    local FLY_SPEED=100
    stopFly=function()
        if flyConn then flyConn:Disconnect(); flyConn=nil end
        for _,obj in ipairs(flyParts) do if obj and obj.Parent then obj:Destroy() end end
        table.clear(flyParts)
        local hum=getHumanoid(); if hum then hum.PlatformStand=false end
    end
    local function startFly()
        stopFly()
        local char=player.Character; local hrp=char and char:FindFirstChild("HumanoidRootPart"); local hum=getHumanoid()
        if not(hrp and hum) then return end
        local att=new("Attachment",{Parent=hrp})
        local lv=new("LinearVelocity",{Attachment0=att,MaxForce=math.huge,VelocityConstraintMode=Enum.VelocityConstraintMode.Vector,RelativeTo=Enum.ActuatorRelativeTo.World,VectorVelocity=Vector3.zero,Parent=hrp})
        local ao=new("AlignOrientation",{Mode=Enum.OrientationAlignmentMode.OneAttachment,Attachment0=att,MaxTorque=math.huge,Responsiveness=30,Parent=hrp})
        flyParts={att,lv,ao}; hum.PlatformStand=true
        flyConn=RunService.RenderStepped:Connect(function()
            local cam=workspace.CurrentCamera; if not cam or not hrp.Parent then return end
            local dir=Vector3.zero
            if not UserInputService:GetFocusedTextBox() then
                if UserInputService:IsKeyDown(Enum.KeyCode.W)           then dir+=cam.CFrame.LookVector  end
                if UserInputService:IsKeyDown(Enum.KeyCode.S)           then dir-=cam.CFrame.LookVector  end
                if UserInputService:IsKeyDown(Enum.KeyCode.D)           then dir+=cam.CFrame.RightVector end
                if UserInputService:IsKeyDown(Enum.KeyCode.A)           then dir-=cam.CFrame.RightVector end
                if UserInputService:IsKeyDown(Enum.KeyCode.Space)       then dir+=Vector3.yAxis          end
                if UserInputService:IsKeyDown(Enum.KeyCode.LeftControl) then dir-=Vector3.yAxis          end
            end
            lv.VectorVelocity=dir.Magnitude>0 and dir.Unit*FLY_SPEED or Vector3.zero
            local look=cam.CFrame.LookVector; local flat=Vector3.new(look.X,0,look.Z)
            if flat.Magnitude>0.01 then ao.CFrame=CFrame.lookAt(Vector3.zero,flat) end
        end)
    end
    track(player.CharacterAdded,function() if flying then task.wait(0.5); startFly() end end)
    stopNoclip=function()
        if noclipConn then noclipConn:Disconnect(); noclipConn=nil end
        local char=player.Character
        if char then for _,p in ipairs(char:GetDescendants()) do if p:IsA("BasePart") then p.CanCollide=true end end end
    end
    local function startNoclip()
        stopNoclip()
        noclipConn=RunService.Stepped:Connect(function()
            local char=player.Character; if not char then return end
            for _,p in ipairs(char:GetDescendants()) do if p:IsA("BasePart") then p.CanCollide=false end end
        end)
    end
    track(player.CharacterAdded,function()
        if noclipEnabled then task.wait(0.5); startNoclip() end
    end)

    -- TP Kill — enemies only, team check included
    local function getNearestEnemy()
        local myChar=player.Character; local myRoot=myChar and myChar:FindFirstChild("HumanoidRootPart")
        if not myRoot then return nil end
        local best=nil; local bestDist=math.huge; local candidates={}
        for _,p in pairs(Players:GetPlayers()) do
            if p~=player and p.Character then
                -- Skip teammates; falls through in teamless games (both teams nil)
                local sameTeam = player.Team ~= nil and p.Team ~= nil and player.Team == p.Team
                if not sameTeam then
                    table.insert(candidates,{char=p.Character,root=p.Character:FindFirstChild("HumanoidRootPart")})
                end
            end
        end
        -- NPC enemies via TR_EnemyOutline
        for _,m in pairs(workspace:GetChildren()) do
            if m:IsA("Model") and m~=myChar and not Players:GetPlayerFromCharacter(m) then
                if m:FindFirstChild("TR_EnemyOutline") or m:FindFirstChild("TR_EnemyOutline",true) then
                    table.insert(candidates,{char=m,root=m:FindFirstChild("HumanoidRootPart")})
                end
            end
        end
        for _,c in pairs(candidates) do
            if c.root then
                local hum=c.char:FindFirstChildOfClass("Humanoid")
                if hum and hum.Health>0 then
                    local dist=(c.root.Position-myRoot.Position).Magnitude
                    if dist<bestDist then bestDist=dist; best=c end
                end
            end
        end
        return best
    end
    local function doTPKill()
        if tpKillCooldown then return end
        local myChar=player.Character; local myRoot=myChar and myChar:FindFirstChild("HumanoidRootPart")
        if not myRoot then return end
        local target=getNearestEnemy()
        if not target or not target.root then notify("TP Kill","No enemy found",1.5); return end
        tpKillCooldown=true
        local behindCF=target.root.CFrame*CFrame.new(0,0,2.5)
        myRoot.CFrame=CFrame.new(behindCF.Position,target.root.Position)
        task.delay(tpKillDelay/1000,function()
            if not myChar or not myChar.Parent then tpKillCooldown=false; return end
            if myRoot.Parent then myRoot.CFrame=CFrame.new(myRoot.Position,target.root.Position) end
            local tool=myChar:FindFirstChildOfClass("Tool")
            if tool then
                pcall(function() tool:Activate() end)
                pcall(function()
                    for _,v in pairs(tool:GetDescendants()) do
                        if v:IsA("RemoteEvent") then pcall(function() v:FireServer(target.root.Position) end) end
                    end
                end)
                pcall(function()
                    local remote=tool:FindFirstChild("RemoteEvent") or tool:FindFirstChild("Event")
                    if remote and remote:IsA("RemoteEvent") then remote:FireServer("attack",target.root.Position) end
                end)
            else notify("TP Kill","No tool equipped",1.5) end
            task.delay(0.4,function() tpKillCooldown=false end)
        end)
    end

    -- All keybind listeners
    track(UserInputService.InputBegan,function(input,gpe)
        if gpe then return end
        if flyKey~=Enum.KeyCode.Unknown and input.KeyCode==flyKey then
            flying=not flying; if flying then startFly() else stopFly() end
            notify("Fly",flying and "ON" or "OFF",1.5)
        end
        if noclipKey~=Enum.KeyCode.Unknown and input.KeyCode==noclipKey then
            noclipEnabled=not noclipEnabled
            if noclipEnabled then startNoclip() else stopNoclip() end
            notify("Noclip",noclipEnabled and "ON" or "OFF",1.5)
        end
        if tpKillKey~=Enum.KeyCode.Unknown and input.KeyCode==tpKillKey then
            if tpKillEnabled then doTPKill() end
        end
    end)

    -- Movement tab UI
    makeSectionHeader(movePage,"Movement",1)
    makeSlider(movePage,"Walk Speed",8,60,16,function(v) MOVE.walkSpeed=v;MOVE.speedDirty=true;applyMovement() end,"walkSpeed",2)
    makeSlider(movePage,"Jump Power",30,200,50,function(v) MOVE.jumpPower=v;MOVE.jumpDirty=true;applyMovement() end,"jumpPower",3)
    makeSectionHeader(movePage,"Flight",4)
    makeToggle(movePage,"Fly  (WASD · Space · Ctrl)",false,function(v) flying=v; if v then startFly() else stopFly() end end,nil,5)
    makeKeybind(movePage,"Fly Keybind",Enum.KeyCode.Unknown,function(k) flyKey=k end,"flyKey",6)
    makeSectionHeader(movePage,"Noclip",7)
    makeToggle(movePage,"Noclip",false,function(v) noclipEnabled=v; if v then startNoclip() else stopNoclip() end end,nil,8)
    makeKeybind(movePage,"Noclip Keybind",Enum.KeyCode.Unknown,function(k) noclipKey=k end,"noclipKey",9)
    makeSectionHeader(movePage,"TP Kill",10)
    makeToggle(movePage,"TP Kill Enabled",false,function(v) tpKillEnabled=v end,"tpKill",11)
    makeKeybind(movePage,"TP Kill Keybind",Enum.KeyCode.Unknown,function(k) tpKillKey=k end,"tpKillKey",12)
    makeSlider(movePage,"Attack Delay  (ms)",50,500,150,function(v) tpKillDelay=v end,"tpKillDelay",13)
    makeInfoRow(movePage,"Enemies only · skips teammates · fires equipped tool",14)
    makeSectionHeader(movePage,"Fake Lag",15)
    makeToggle(movePage,"Fake Lag",false,function(v) if v then startFakeLag() else stopFakeLag() end end,"fakeLag",16)
    makeSlider(movePage,"Freeze Duration  (ms)",100,2000,500,function(v) fakeLagFreezeMs=v end,"fakeLagMs",17)
    makeInfoRow(movePage,"Queues all FireServer calls during freeze  ·  flushes as burst",18)
    makeSectionHeader(movePage,"Extras",19)
    makeToggle(movePage,"Infinite Jump",false,function(v) infJumpEnabled=v end,"infJump",20)
    makeToggle(movePage,"Anti-Void",false,function(v) antiVoidEnabled=v end,"antiVoid",21)
end

------------------------------------------------------------------------
-- Utility
------------------------------------------------------------------------
local autoAfkEnabled        = false
local spectatorDetectEnabled= false
local radarEnabled          = false
local notifiedSpectators    = {}

pcall(function()
    Players.LocalPlayer.Idled:Connect(function()
        if not autoAfkEnabled then return end
        VirtualUser:Button2Down(Vector2.new(0,0),workspace.CurrentCamera.CFrame)
        task.wait(1); VirtualUser:Button2Up(Vector2.new(0,0),workspace.CurrentCamera.CFrame)
    end)
end)

task.spawn(function()
    while gui.Parent do
        task.wait(3)
        if not spectatorDetectEnabled then notifiedSpectators={}; continue end
        for _,p in ipairs(Players:GetPlayers()) do
            if p~=player and not p.Character then
                if not notifiedSpectators[p] then
                    notifiedSpectators[p]=true; notify("Spectator",p.Name.." may be watching",4)
                end
            else notifiedSpectators[p]=nil end
        end
    end
end)

track(RunService.RenderStepped,function()
    if not radarEnabled then return end
    local myChar=player.Character; local myRoot=myChar and myChar:FindFirstChild("HumanoidRootPart")
    if not myRoot then return end
    for plr,dot in pairs(radarDots) do
        if not espObjects[plr] then dot:Destroy(); radarDots[plr]=nil end
    end
    local cam=workspace.CurrentCamera
    local camRight=cam.CFrame.RightVector; local camForward=cam.CFrame.LookVector
    local right2D=Vector2.new(camRight.X,camRight.Z); local fwd2D=Vector2.new(camForward.X,camForward.Z)
    for plr,_ in pairs(espObjects) do
        local char=plr.Character; local root=char and char:FindFirstChild("HumanoidRootPart")
        if not root then if radarDots[plr] then radarDots[plr].Visible=false end; continue end
        local rel=root.Position-myRoot.Position; local flat=Vector2.new(rel.X,rel.Z)
        local rx=flat:Dot(right2D)/RADAR_RANGE; local ry=flat:Dot(fwd2D)/RADAR_RANGE
        local px=math.clamp((rx*0.5+0.5)*RADAR_SIZE,4,RADAR_SIZE-4)
        local py=math.clamp((0.5-ry*0.5)*RADAR_SIZE,4,RADAR_SIZE-4)
        if not radarDots[plr] then
            radarDots[plr]=new("Frame",{Size=UDim2.fromOffset(6,6),AnchorPoint=Vector2.new(0.5,0.5),
                BackgroundColor3=RED,BorderSizePixel=0,ZIndex=21,Parent=radarHolder},{corner(3)})
        end
        radarDots[plr].Position=UDim2.fromOffset(px,py); radarDots[plr].Visible=true
    end
end)

do
    makeSectionHeader(utilPage,"Anti-AFK",1)
    makeToggle(utilPage,"Anti-AFK",false,function(v) autoAfkEnabled=v end,"antiAfk",2)
    makeInfoRow(utilPage,"Blocks idle kick by simulating input.",3)
    makeSectionHeader(utilPage,"Server",4)
    makeActionRow(utilPage,"Server Hop","HOP",function()
        notify("Server Hop","Joining new server...",2)
        task.delay(1,function() pcall(function() TeleportService:Teleport(game.PlaceId,player) end) end)
    end,5)
    makeActionRow(utilPage,"Rejoin","REJOIN",function()
        notify("Rejoin","Rejoining...",2)
        task.delay(1,function() pcall(function() TeleportService:Teleport(game.PlaceId,player) end) end)
    end,6)
    makeSectionHeader(utilPage,"Detection",7)
    makeToggle(utilPage,"Spectator Detection",false,function(v)
        spectatorDetectEnabled=v; if not v then notifiedSpectators={} end
    end,"spectatorDetect",8)
    makeInfoRow(utilPage,"Notifies when a player has no character (spectating).",9)
    makeSectionHeader(utilPage,"Radar",10)
    makeToggle(utilPage,"Player Radar",false,function(v)
        radarEnabled=v; radarHolder.Visible=v
        if not v then for _,dot in pairs(radarDots) do dot:Destroy() end; table.clear(radarDots) end
    end,"radar",11)
    makeInfoRow(utilPage,"Top-down · Camera-relative · 300 stud range",12)
end

------------------------------------------------------------------------
-- Configs
------------------------------------------------------------------------
local store={configs={},autoload=nil}
local applySettings
local refreshConfigList

local function captureSettings()
    local cfg={}; for k,ctrl in pairs(controls) do cfg[k]=ctrl.get() end; return cfg
end
applySettings=function(cfg)
    if type(cfg)~="table" then return end
    for k,v in pairs(cfg) do
        local ctrl=controls[k]
        if ctrl and type(v)==type(ctrl.get()) then pcall(ctrl.set,v) end
    end
end
local function persist() fileWrite(store) end

do
    local saved=fileRead()
    if saved then
        store.configs  = type(saved.configs) =="table"  and saved.configs  or {}
        store.autoload = type(saved.autoload)=="string" and saved.autoload or nil
    end
end

do
    local MAX_CONFIGS=20; local MAX_NAME=24
    makeSectionHeader(configsPage,"Saved Configs",1)
    makeInfoRow(configsPage,"Writes to disk — survives between sessions.",2)
    local nameRow=makeRow(configsPage,54,3)
    local nameBox=new("TextBox",{Text="",PlaceholderText="Config name…",PlaceholderColor3=T.sub,
        TextColor3=T.text,Font=FONT,TextSize=12,TextXAlignment=Enum.TextXAlignment.Left,ClearTextOnFocus=false,
        BackgroundColor3=T.off,Size=UDim2.new(1,-108,0,30),Position=UDim2.fromOffset(10,12),Parent=nameRow},{corner(6),pad(0,10,10,0)})
    local nbS=Instance.new("UIStroke"); nbS.Color=T.accent; nbS.Transparency=0.6; nbS.Thickness=1; nbS.Parent=nameBox
    track(nameBox.Focused,   function() tw(nbS,{Transparency=0.2},0.15) end)
    track(nameBox.FocusLost, function() tw(nbS,{Transparency=0.6},0.15) end)
    local saveBtn=new("TextButton",{Text="Save",Font=FONT_BOLD,TextSize=12,TextColor3=T.text,
        BackgroundColor3=T.accent,AutoButtonColor=false,Size=UDim2.fromOffset(76,30),
        AnchorPoint=Vector2.new(1,0),Position=UDim2.new(1,-10,0,12),Parent=nameRow},{corner(6)})
    track(saveBtn.MouseEnter,function() tw(saveBtn,{BackgroundColor3=T.accentBr},0.15) end)
    track(saveBtn.MouseLeave,function() tw(saveBtn,{BackgroundColor3=T.accent},0.15)   end)
    local listHolder=new("Frame",{Size=UDim2.new(1,0,0,0),AutomaticSize=Enum.AutomaticSize.Y,
        BackgroundTransparency=1,LayoutOrder=4,Parent=configsPage},
        {new("UIListLayout",{Padding=UDim.new(0,6),SortOrder=Enum.SortOrder.LayoutOrder})})
    local function smallBtn(parent,label,color,order,cb)
        local b=new("TextButton",{Text=label,Font=FONT_BOLD,TextSize=10,TextColor3=T.text,
            BackgroundColor3=color,AutoButtonColor=false,Size=UDim2.fromOffset(42,24),LayoutOrder=order,Parent=parent},{corner(5)})
        b.MouseButton1Click:Connect(cb); return b
    end
    local function addConfigRow(name,order)
        local row=makeRow(listHolder,42,order)
        local lbl=makeLabel(row,name,12); lbl.Size=UDim2.new(1,-168,1,0); lbl.TextTruncate=Enum.TextTruncate.AtEnd
        local btns=new("Frame",{Size=UDim2.fromOffset(148,24),AnchorPoint=Vector2.new(1,0.5),
            Position=UDim2.new(1,-10,0.5,0),BackgroundTransparency=1,Parent=row},{
            new("UIListLayout",{FillDirection=Enum.FillDirection.Horizontal,HorizontalAlignment=Enum.HorizontalAlignment.Right,
                VerticalAlignment=Enum.VerticalAlignment.Center,Padding=UDim.new(0,5),SortOrder=Enum.SortOrder.LayoutOrder})})
        smallBtn(btns,"Load",T.accent,1,function() applySettings(store.configs[name]); notify("Loaded",name,2) end)
        smallBtn(btns,"Auto",(store.autoload==name) and T.accentBr or T.off,2,function()
            if store.autoload==name then store.autoload=nil else store.autoload=name end
            persist(); refreshConfigList()
            notify("Auto-load",store.autoload and (name.." on execute") or "Off",2)
        end)
        smallBtn(btns,"Del",T.danger,3,function()
            store.configs[name]=nil; if store.autoload==name then store.autoload=nil end
            persist(); refreshConfigList(); notify("Deleted",name,2)
        end)
    end
    refreshConfigList=function()
        for _,child in ipairs(listHolder:GetChildren()) do
            if not child:IsA("UIListLayout") then child:Destroy() end
        end
        local names={}; for n in pairs(store.configs) do table.insert(names,n) end; table.sort(names)
        if #names==0 then
            new("TextLabel",{Text="No configs — name one above and press Save.",Font=FONT,TextSize=11,TextColor3=T.sub,
                BackgroundTransparency=1,Size=UDim2.new(1,0,0,28),Parent=listHolder}); return
        end
        for i,name in ipairs(names) do addConfigRow(name,i) end
    end
    local function doSave()
        local name=(nameBox.Text):match("^%s*(.-)%s*$")
        if name=="" then notify("Configs","Enter a name first.",2); return end
        name=name:sub(1,MAX_NAME)
        local count=0; for _ in pairs(store.configs) do count+=1 end
        if not store.configs[name] and count>=MAX_CONFIGS then notify("Configs","Max "..MAX_CONFIGS.." configs.",3); return end
        store.configs[name]=captureSettings(); nameBox.Text=""
        persist(); refreshConfigList(); notify("Saved",name,2)
    end
    track(saveBtn.MouseButton1Click,doSave)
    track(nameBox.FocusLost,function(enter) if enter then doSave() end end)
    refreshConfigList()
end

------------------------------------------------------------------------
-- Panic
------------------------------------------------------------------------
do
    local unloaded=false
    local function unloadAll()
        if unloaded then return end; unloaded=true
        particlesAlive=false
        flying=false; if stopFly then stopFly() end
        noclipEnabled=false; if stopNoclip then stopNoclip() end
        infJumpEnabled=false; antiVoidEnabled=false
        tpKillEnabled=false; tpKillCooldown=false
        if fakeLagEnabled then stopFakeLag() end
        pcall(function() if FOVCircle then FOVCircle.Visible=false; FOVCircle:Remove() end end)
        if indicatorFrame and indicatorFrame.Parent then indicatorFrame.Visible=false end
        for plr,o in pairs(espObjects) do if clearESPObj then clearESPObj(o) end; espObjects[plr]=nil end
        if ESPFolder      and ESPFolder.Parent      then ESPFolder:Destroy()      end
        if boxHolder      and boxHolder.Parent      then boxHolder:Destroy()      end
        if skelHolder     and skelHolder.Parent     then skelHolder:Destroy()     end
        if tracerHolder   and tracerHolder.Parent   then tracerHolder:Destroy()   end
        if hpBarHolder    and hpBarHolder.Parent    then hpBarHolder:Destroy()    end
        if particleHolder and particleHolder.Parent then particleHolder:Destroy() end
        if radarHolder    and radarHolder.Parent    then radarHolder:Destroy()    end
        pcall(function()
            Lighting.Ambient=origAmbient; Lighting.OutdoorAmbient=origOutdoorAmbient
            Lighting.Brightness=origBrightness; Lighting.ClockTime=origClockTime
            Lighting.FogEnd=origFogEnd; Lighting.FogStart=origFogStart
        end)
        local hum=getHumanoid and getHumanoid()
        if hum then
            if MOVE.origSpeed then hum.WalkSpeed=MOVE.origSpeed end
            if MOVE.origJump  then hum.JumpPower=MOVE.origJump  end
            hum.PlatformStand=false
        end
        local cam=workspace.CurrentCamera; if cam then cam.FieldOfView=origFov or 70 end
        disconnectAll(); gui:Destroy()
    end
    makeSectionHeader(panicPage,"Panic",1)
    local unloadRow=makeRow(panicPage,60,2)
    makeLabel(unloadRow,"Unload  Corz v4.4",14,T.text,FONT_BOLD).Position=UDim2.fromOffset(14,-10)
    makeLabel(unloadRow,"Restores all settings  ·  clears all features.",11,T.sub).Position=UDim2.fromOffset(14,14)
    local unloadBtn=new("TextButton",{Text="UNLOAD",Font=FONT_BOLD,TextSize=11,TextColor3=T.text,
        BackgroundColor3=T.danger,AutoButtonColor=false,Size=UDim2.fromOffset(76,28),
        AnchorPoint=Vector2.new(1,0.5),Position=UDim2.new(1,-12,0.5,0),Parent=unloadRow},{corner(5)})
    track(unloadBtn.MouseEnter,        function() tw(unloadBtn,{BackgroundColor3=T.dangerHov},0.12) end)
    track(unloadBtn.MouseLeave,        function() tw(unloadBtn,{BackgroundColor3=T.danger},0.12)    end)
    track(unloadBtn.MouseButton1Click, unloadAll)
end

------------------------------------------------------------------------
-- Boot
------------------------------------------------------------------------
selectTab("Home")
uiScale.Scale=0.7; window.Visible=true
task.defer(function() twBack(uiScale,{Scale=1},0.45) end)

if store.autoload and store.configs[store.autoload] then
    task.defer(function()
        applySettings(store.configs[store.autoload])
        notify("Auto-injected",store.autoload.." loaded",3.5)
    end)
else
    task.delay(0.5,function() notify("Corz v4.4","Online  ·  RightShift to toggle",4) end)
end

Features

  • Silent Aim, AutoTPKill, Noclip, Movement Cheats
CORZ · RoScripts