Загрузка данных


-- UNIVERSAL CHEAT TESTER v1.0 | authorized Roblox place testing
-- Client-side executor script. Toggle UI: floating LAB button or RightShift.
-- Effects are best-effort client-side tests: server-side persistence is NOT implied.
local Players = game:GetService('Players')
local RunService = game:GetService('RunService')
local UIS = game:GetService('UserInputService')
local Lighting = game:GetService('Lighting')
local VirtualUser = game:GetService('VirtualUser')
local CollectionService = game:GetService('CollectionService')
local localPlayer = Players.LocalPlayer
if not localPlayer then warn('[SEC LAB] No LocalPlayer') return end
local store = type(getgenv) == 'function' and getgenv() or _G
pcall(function() if type(store.__SEC_LAB_STOP) == 'function' then store.__SEC_LAB_STOP() end end)
local alive = true
local connections = {}
local S = {}
local cfg = {speed=40, jump=110, fly=65, gravity=65, spin=22, range=75,
            fling=190, vehicle=115, aura=14, hitbox=5, reach=12, clickRate=6,
            fov=180, grabDistance=15, freecam=45}
local stash = {collision={}, xray={}, prompt={}, hitbox={}, reach={}, otherCollisions={}, states={}}
local original = {gravity=workspace.Gravity, cameraMax=localPlayer.CameraMaxZoomDistance,
                  cameraMin=localPlayer.CameraMinZoomDistance,
                  brightness=Lighting.Brightness, clock=Lighting.ClockTime,
                  ambient=Lighting.Ambient, outdoor=Lighting.OutdoorAmbient,
                  fog=Lighting.FogEnd, shadows=Lighting.GlobalShadows,
                  exposure=Lighting.ExposureCompensation}
local playerHighlights = {}
local itemHighlights = {}
local lineFrames = {}
local oldCamera = nil
local flyBV, flyBG, flyRoot, flyPlatformStand, flyHum
local airPlatform, grabBP, grabbedPart
local rightHeld, leftHeld = false, false
local mouse = localPlayer:GetMouse()
local monitorLast, statsConnected
local hasTouch = type(firetouchinterest) == 'function'
local hasPrompt = type(fireproximityprompt) == 'function'
local canClick = type(mouse1click) == 'function'
local rootGui
local statusText
local main, openButton
local actions = {}
local togglesUI = {}
local tabPages = {}
local busyTimers = {}
local track = function(c) table.insert(connections,c) return c end
local function safe(fn) local ok,result=pcall(fn); if not ok then warn('[SEC LAB] '..tostring(result)) end return ok,result end
local function status(msg) print('[SEC LAB] '..tostring(msg)); if statusText then statusText.Text=tostring(msg) end end
local function root()
    local c=localPlayer.Character
    return c, c and c:FindFirstChildOfClass('Humanoid'), c and c:FindFirstChild('HumanoidRootPart')
end
local function camera() return workspace.CurrentCamera end
local function localTools()
    local c=localPlayer.Character
    return c and c:FindFirstChildOfClass('Tool')
end
local function getNearbyPlayer(maxdist, requireVision)
    local _,_,r=root(); local cam=camera(); if not r or not cam then return nil end
    local best,score
    for _,p in ipairs(Players:GetPlayers()) do
        if p~=localPlayer and p.Character then
            local humanoid=p.Character:FindFirstChildOfClass('Humanoid')
            local head=p.Character:FindFirstChild('Head') or p.Character:FindFirstChild('HumanoidRootPart')
            if humanoid and humanoid.Health>0 and head and (not localPlayer.Team or p.Team~=localPlayer.Team) then
                local distance=(head.Position-r.Position).Magnitude
                if distance<maxdist then
                    local pos,visible=cam:WorldToViewportPoint(head.Position)
                    if visible then
                        local center=cam.ViewportSize/2
                        local pixels=(Vector2.new(pos.X,pos.Y)-center).Magnitude
                        local sightOK=true
                        if requireVision then
                            local params=RaycastParams.new();params.FilterType=Enum.RaycastFilterType.Exclude
                            params.FilterDescendantsInstances={localPlayer.Character}
                            local hit=workspace:Raycast(cam.CFrame.Position,head.Position-cam.CFrame.Position,params)
                            sightOK=not hit or hit.Instance:IsDescendantOf(p.Character)
                        end
                        if pixels<=cfg.fov and sightOK then
                            if not score or pixels<score then best,score=p,pixels end
                        end
                    end
                end
            end
        end
    end
    return best
end
local function addPartRestore(map, part, prop, value)
    if not map[part] then map[part]=part[prop] end
    part[prop]=value
end
local function restoreMap(map, prop)
    for part,old in pairs(map) do pcall(function() if part and part.Parent then part[prop]=old end end); map[part]=nil end
end
local function removeFly()
    if flyBV then flyBV:Destroy() flyBV=nil end
    if flyBG then flyBG:Destroy() flyBG=nil end
    if flyHum and flyHum.Parent and flyPlatformStand~=nil then flyHum.PlatformStand=flyPlatformStand end
    flyRoot=nil;flyHum=nil;flyPlatformStand=nil
end
local function ensureFly()
    local _,h,r=root(); if not h or not r then return end
    if flyRoot==r and flyBV and flyBG then return end
    removeFly();flyRoot=r;flyHum=h;flyPlatformStand=h.PlatformStand
    flyBV=Instance.new('BodyVelocity');flyBV.Name='sec_lab_fly_velocity'
    flyBV.MaxForce=Vector3.new(1e7,1e7,1e7);flyBV.P=6000;flyBV.Parent=r
    flyBG=Instance.new('BodyGyro');flyBG.Name='sec_lab_fly_orientation'
    flyBG.MaxTorque=Vector3.new(1e7,1e7,1e7);flyBG.P=9000;flyBG.D=500;flyBG.Parent=r
    h.PlatformStand=true
end
local function disableGrab()
    if grabBP then grabBP:Destroy() grabBP=nil end
    grabbedPart=nil
end
local function refreshESP()
    local _,_,myroot=root()
    for _,p in ipairs(Players:GetPlayers()) do
        if p~=localPlayer then
            local character=p.Character
            if character and S.playerESP then
                local entry=playerHighlights[p]
                if not entry or entry.character~=character then
                    if entry then if entry.h then entry.h:Destroy() end if entry.bill then entry.bill:Destroy() end end
                    local h=Instance.new('Highlight');h.Name='sec_lab_player_highlight';h.Adornee=character
                    h.DepthMode=Enum.HighlightDepthMode.AlwaysOnTop
                    h.FillColor=Color3.fromRGB(255,76,76);h.OutlineColor=Color3.fromRGB(255,255,255)
                    h.FillTransparency=.65;h.Parent=character
                    local head=character:FindFirstChild('Head') or character:FindFirstChild('HumanoidRootPart')
                    local bill
                    if head then
                        bill=Instance.new('BillboardGui');bill.Name='sec_lab_player_label';bill.Adornee=head
                        bill.AlwaysOnTop=true;bill.Size=UDim2.fromOffset(180,32)
                        bill.StudsOffsetWorldSpace=Vector3.new(0,3,0);bill.Parent=head
                        local lab=Instance.new('TextLabel');lab.Size=UDim2.fromScale(1,1);lab.BackgroundTransparency=1
                        lab.Font=Enum.Font.GothamBold;lab.TextSize=14;lab.TextColor3=Color3.new(1,1,1)
                        lab.TextStrokeTransparency=.35;lab.Text=p.Name;lab.Parent=bill
                    end
                    playerHighlights[p]={character=character,h=h,bill=bill}
                end
                if playerHighlights[p].bill then
                    local label=playerHighlights[p].bill:FindFirstChildOfClass('TextLabel')
                    local target=character:FindFirstChild('HumanoidRootPart')
                    if label then label.Text=p.Name..(myroot and target and (' | '..math.floor((myroot.Position-target.Position).Magnitude)..' studs') or '') end
                end
            end
        end
    end
    for p,e in pairs(playerHighlights) do
        if not S.playerESP or not p.Parent or p.Character~=e.character then
            if e.h then e.h:Destroy() end if e.bill then e.bill:Destroy() end playerHighlights[p]=nil
        end
    end
end
local function itemCandidate(x)
    if x:IsA('Tool') then return x:FindFirstChild('Handle') or x:FindFirstChildWhichIsA('BasePart'),x.Name end
    if x:IsA('Model') then
        for _,tag in ipairs({'loot','pickup','collectible','item'}) do
            if CollectionService:HasTag(x,tag) then return x.PrimaryPart or x:FindFirstChildWhichIsA('BasePart'),x.Name end
        end
    end
    return nil
end
local function refreshItems()
    if not S.itemESP then
        for obj,e in pairs(itemHighlights) do if e.h then e.h:Destroy() end if e.b then e.b:Destroy() end itemHighlights[obj]=nil end
        return
    end
    local count=0
    for _,x in ipairs(workspace:GetDescendants()) do
        if count>=110 then break end
        local part,name=itemCandidate(x)
        if part and part:IsDescendantOf(workspace) and not (localPlayer.Character and x:IsDescendantOf(localPlayer.Character)) then
            count=count+1
            if not itemHighlights[x] then
                local h=Instance.new('Highlight');h.Name='sec_lab_item_highlight';h.Adornee=part
                h.DepthMode=Enum.HighlightDepthMode.AlwaysOnTop
                h.FillColor=Color3.fromRGB(255,200,44);h.OutlineColor=Color3.fromRGB(255,255,255)
                h.FillTransparency=.65;h.Parent=x
                local b=Instance.new('BillboardGui');b.Name='sec_lab_item_label';b.Adornee=part
                b.Size=UDim2.fromOffset(170,26);b.StudsOffsetWorldSpace=Vector3.new(0,2,0);b.AlwaysOnTop=true;b.Parent=part
                local l=Instance.new('TextLabel');l.Size=UDim2.fromScale(1,1);l.BackgroundTransparency=1
                l.Text=name;l.TextColor3=Color3.fromRGB(255,231,130);l.TextStrokeTransparency=.3
                l.TextSize=13;l.Font=Enum.Font.GothamBold;l.Parent=b
                itemHighlights[x]={h=h,b=b}
            end
        end
    end
    for x,e in pairs(itemHighlights) do
        if not x:IsDescendantOf(workspace) then
            if e.h then e.h:Destroy() end if e.b then e.b:Destroy() end itemHighlights[x]=nil
        end
    end
end
local function applyXray()
    if not S.xray then restoreMap(stash.xray,'LocalTransparencyModifier');return end
    local n=0
    for _,x in ipairs(workspace:GetDescendants()) do
        if n>=3500 then break end
        if x:IsA('BasePart') and x.Anchored and not x:IsDescendantOf(localPlayer.Character or workspace.Terrain) then
            local skip=false
            for _,p in ipairs(Players:GetPlayers()) do
                if p.Character and x:IsDescendantOf(p.Character) then skip=true break end
            end
            if not skip then addPartRestore(stash.xray,x,'LocalTransparencyModifier',.72);n=n+1 end
        end
    end
    status('X-Ray: '..n..' parts (client only)')
end
local function applyPrompts()
    if not (S.instantPrompt or S.promptReach or S.promptLOS) then
        for obj,v in pairs(stash.prompt) do
            pcall(function() if obj.Parent then
                obj.HoldDuration=v[1];obj.MaxActivationDistance=v[2];obj.RequiresLineOfSight=v[3]
            end end)
            stash.prompt[obj]=nil
        end
        return
    end
    for _,o in ipairs(workspace:GetDescendants()) do
        if o:IsA('ProximityPrompt') then
            if not stash.prompt[o] then stash.prompt[o]={o.HoldDuration,o.MaxActivationDistance,o.RequiresLineOfSight} end
            local orig=stash.prompt[o]
            pcall(function()
                o.HoldDuration=S.instantPrompt and 0 or orig[1]
                o.MaxActivationDistance=S.promptReach and cfg.range or orig[2]
                o.RequiresLineOfSight=S.promptLOS and false or orig[3]
            end)
        end
    end
end
local function updatePlayerSettings()
    local c,h,r=root();if not h then return end
    if c~=stash.humChar then
        stash.humChar=c
        stash.humData={walk=h.WalkSpeed,jump=h.JumpPower,jumpHeight=h.JumpHeight,useJump=h.UseJumpPower}
    end
    if S.speed then h.WalkSpeed=cfg.speed end
    if S.jump then h.UseJumpPower=true;h.JumpPower=cfg.jump end
end
local function undoToggle(k)
    local c,h=root()
    if k=='speed' and h and stash.humData then h.WalkSpeed=stash.humData.walk end
    if k=='jump' and h and stash.humData then
        h.UseJumpPower=stash.humData.useJump;h.JumpPower=stash.humData.jump;h.JumpHeight=stash.humData.jumpHeight
    end
    if k=='fly' then removeFly() end
    if k=='noclip' then restoreMap(stash.collision,'CanCollide') end
    if k=='gravity' then workspace.Gravity=original.gravity end
    if k=='airwalk' and airPlatform then airPlatform:Destroy();airPlatform=nil end
    if k=='playerESP' then refreshESP() end
    if k=='itemESP' then refreshItems() end
    if k=='tracers' then for _,f in pairs(lineFrames) do f:Destroy() end lineFrames={} end
    if k=='xray' then applyXray() end
    if k=='fullbright' then
        Lighting.Brightness=original.brightness;Lighting.ClockTime=original.clock
        Lighting.Ambient=original.ambient;Lighting.OutdoorAmbient=original.outdoor
        Lighting.FogEnd=original.fog;Lighting.GlobalShadows=original.shadows
        Lighting.ExposureCompensation=original.exposure
    end
    if k=='zoom' then
        localPlayer.CameraMaxZoomDistance=original.cameraMax
        localPlayer.CameraMinZoomDistance=original.cameraMin
    end
    if k=='freecam' or k=='spectate' then
        local cam=camera()
        if cam then cam.CameraType=Enum.CameraType.Custom;if h then cam.CameraSubject=h end end
    end
    if k=='instantPrompt' or k=='promptReach' or k=='promptLOS' then applyPrompts() end
    if k=='hitbox' then
        for part,val in pairs(stash.hitbox) do pcall(function() if part.Parent then
            part.Size=val[1];part.Transparency=val[2];part.CanCollide=val[3]
        end end) stash.hitbox[part]=nil end
    end
    if k=='reach' then restoreMap(stash.reach,'Size') end
    if k=='antiFling' then restoreMap(stash.otherCollisions,'CanCollide') end
    if k=='grab' then disableGrab() end
    if k=='fling' then local _,_,r=root();if r then r.AssemblyAngularVelocity=Vector3.zero end end
    if k=='antiRagdoll' and h and stash.states[c] then
        for typ,v in pairs(stash.states[c]) do pcall(function() h:SetStateEnabled(typ,v) end) end
    end
end
local function onToggle(k,on)
    S[k]=on
    if not on then safe(function() undoToggle(k) end) end
    if on then
        if k=='xray' then safe(applyXray) end
        if k=='instantPrompt' or k=='promptReach' or k=='promptLOS' then safe(applyPrompts) end
        if k=='playerESP' then safe(refreshESP) end
        if k=='itemESP' then safe(refreshItems) end
        if k=='freecam' then
            local cam=camera();if cam then
                oldCamera={cf=cam.CFrame,type=cam.CameraType,subject=cam.CameraSubject}
                cam.CameraType=Enum.CameraType.Scriptable
            end
        end
        if k=='airwalk' then
            airPlatform=Instance.new('Part');airPlatform.Name='sec_lab_air_platform'
            airPlatform.Size=Vector3.new(9,1,9);airPlatform.Anchored=true;airPlatform.CanCollide=true
            airPlatform.Transparency=1;airPlatform.Parent=workspace
        end
        if k=='zoom' then localPlayer.CameraMinZoomDistance=.5;localPlayer.CameraMaxZoomDistance=500 end
    end
    status(k..' -> '..(on and 'ON' or 'OFF')..' | server result not assumed')
end
local function setToggle(k,v)
    if k=='autoPickup' and v and not hasTouch then status('Auto Pickup requires firetouchinterest from executor');return end
    if S[k]==v then return end
    onToggle(k,v)
    if togglesUI[k] then
        togglesUI[k].Text=v and 'ON' or 'OFF'
        togglesUI[k].BackgroundColor3=v and Color3.fromRGB(37,159,123) or Color3.fromRGB(65,74,96)
    end
end
local function pressClick()
    if canClick then safe(mouse1click);return end
    local t=localTools()
    if t then safe(function() t:Activate() end);return end
    safe(function()
        VirtualUser:CaptureController()
        VirtualUser:Button1Down(Vector2.new(0,0),camera().CFrame)
        VirtualUser:Button1Up(Vector2.new(0,0),camera().CFrame)
    end)
end
local function getCenterTarget()
    local cam=camera();if not cam then return nil end
    local params=RaycastParams.new();params.FilterType=Enum.RaycastFilterType.Exclude
    params.FilterDescendantsInstances={localPlayer.Character}
    local res=workspace:Raycast(cam.CFrame.Position,cam.CFrame.LookVector*450,params)
    return res and res.Instance or nil
end
local function tpTo(pos)
    local c,_,r=root();if not c or not r then status('Character unavailable') return end
    if typeof(pos)~='Vector3' then return end
    safe(function() c:PivotTo(CFrame.new(pos+Vector3.new(0,4,0))) end)
end
local function viewportHit(frame, x,y)
    if not frame.Visible then return false end
    local a,b=frame.AbsolutePosition,frame.AbsoluteSize
    return x>=a.X and x<=a.X+b.X and y>=a.Y and y<=a.Y+b.Y
end
local function drawLines()
    if not S.tracers then return end
    local cam=camera();if not cam or not rootGui then return end
    local w,h=cam.ViewportSize.X,cam.ViewportSize.Y
    local seen={}
    for _,p in ipairs(Players:GetPlayers()) do
        if p~=localPlayer and p.Character and p.Character:FindFirstChild('HumanoidRootPart') then
            local v,vis=cam:WorldToViewportPoint(p.Character.HumanoidRootPart.Position)
            local line=lineFrames[p]
            if not line then
                line=Instance.new('Frame');line.Name='sec_lab_tracer';line.BorderSizePixel=0
                line.BackgroundColor3=Color3.fromRGB(255,108,95);line.AnchorPoint=Vector2.new(0,.5)
                line.ZIndex=3;line.Parent=rootGui;lineFrames[p]=line
            end
            local dx,dy=v.X-w/2,v.Y-h*.95
            local length=math.sqrt(dx*dx+dy*dy)
            line.Visible=vis and v.Z>0
            line.Position=UDim2.fromOffset(w/2,h*.95)
            line.Size=UDim2.fromOffset(length,2)
            line.Rotation=math.deg(math.atan2(dy,dx))
            seen[p]=true
        end
    end
    for p,line in pairs(lineFrames) do if not seen[p] then line:Destroy();lineFrames[p]=nil end end
end
local function getClosestPrompt()
    local _,_,r=root();if not r then return nil end
    local best,bestdist
    for _,p in ipairs(workspace:GetDescendants()) do
        if p:IsA('ProximityPrompt') and p.Enabled then
            local o=p.Parent
            local part=o and (o:IsA('BasePart') and o or o:IsA('Attachment') and o.Parent or o:IsA('Model') and o.PrimaryPart)
            if part and part:IsA('BasePart') then
                local d=(r.Position-part.Position).Magnitude
                if d<=math.min(cfg.range, math.max(p.MaxActivationDistance,10)) and (not bestdist or d<bestdist) then best=p;bestdist=d end
            end
        end
    end
    return best
end
local function tryPrompt()
    local p=getClosestPrompt();if not p then return end
    if hasPrompt then safe(function() fireproximityprompt(p) end)
    else safe(function() p:InputHoldBegin();task.delay(math.max(.1,p.HoldDuration),function() pcall(function() p:InputHoldEnd() end) end) end) end
end
local function tryPickup()
    if not hasTouch then return end
    local _,_,r=root();if not r then return end
    for _,x in ipairs(workspace:GetDescendants()) do
        if x:IsA('Tool') and x:FindFirstChild('Handle') then
            if (x.Handle.Position-r.Position).Magnitude<=cfg.range then
                safe(function() firetouchinterest(r,x.Handle,0);firetouchinterest(r,x.Handle,1) end)
                return
            end
        end
    end
end
local function applyHitboxes()
    if not S.hitbox then return end
    for _,p in ipairs(Players:GetPlayers()) do
        if p~=localPlayer and p.Character then
            local head=p.Character:FindFirstChild('Head')
            if head and head:IsA('BasePart') then
                if not stash.hitbox[head] then stash.hitbox[head]={head.Size,head.Transparency,head.CanCollide} end
                head.Size=Vector3.new(cfg.hitbox,cfg.hitbox,cfg.hitbox)
                head.Transparency=.65;head.CanCollide=false
            end
        end
    end
end
local function applyReach()
    if not S.reach then return end
    local t=localTools()
    local handle=t and t:FindFirstChild('Handle')
    if handle and handle:IsA('BasePart') then
        addPartRestore(stash.reach,handle,'Size',Vector3.new(cfg.reach,cfg.reach,cfg.reach))
    end
end
local function antiRagdoll()
    local c,h=root();if not h then return end
    if not stash.states[c] then stash.states[c]={} end
    for _,typ in ipairs({Enum.HumanoidStateType.Ragdoll, Enum.HumanoidStateType.FallingDown}) do
        if stash.states[c][typ]==nil then stash.states[c][typ]=h:GetStateEnabled(typ) end
        h:SetStateEnabled(typ,false)
    end
end
local function doSpectate(name)
    if not name or name=='' then status('Enter player name') return end
    local found
    for _,p in ipairs(Players:GetPlayers()) do
        if p~=localPlayer and string.sub(string.lower(p.Name),1,#name)==string.lower(name) then found=p break end
    end
    if not found then status('Player not found: '..name);return end
    local h=found.Character and found.Character:FindFirstChildOfClass('Humanoid')
    if h then local cam=camera();cam.CameraType=Enum.CameraType.Custom;cam.CameraSubject=h;status('Spectating '..found.Name)
    else status('Target has no humanoid') end
end
local function trackedRemoteScan()
    local list={}
    for _,o in ipairs(game:GetDescendants()) do
        if o:IsA('RemoteEvent') or o:IsA('RemoteFunction') or o:IsA('UnreliableRemoteEvent') then
            table.insert(list,o:GetFullName()..' <'..o.ClassName..'>')
        end
    end
    table.sort(list)
    status('Read-only remote inventory: '..#list..' (console)')
    for _,v in ipairs(list) do print('[SEC LAB REMOTE]',v) end
end
local function scanPlayerPoints()
    local ls=localPlayer:FindFirstChild('leaderstats');local points=ls and ls:FindFirstChild('Points')
    if points and points:IsA('ValueBase') then status('Client-visible Points = '..tostring(points.Value)..' (NOT server proof)')
    else status('leaderstats.Points not found') end
end

-- UI
local function chooseGuiParent()
    local ok,result=pcall(function() return type(gethui)=='function' and gethui() end)
    if ok and typeof(result)=='Instance' then return result end
    ok,result=pcall(function() return game:GetService('CoreGui') end)
    if ok and result then return result end
    return localPlayer:WaitForChild('PlayerGui')
end
rootGui=Instance.new('ScreenGui');rootGui.Name='sec_lab_universal_gui'
rootGui.ResetOnSpawn=false;rootGui.IgnoreGuiInset=true;rootGui.DisplayOrder=999999
safe(function() rootGui.Parent=chooseGuiParent() end)
if not rootGui.Parent then rootGui.Parent=localPlayer:WaitForChild('PlayerGui') end
local function new(class,props,parent)
    local o=Instance.new(class)
    for key,value in pairs(props or {}) do o[key]=value end
    if parent then o.Parent=parent end
    return o
end
local palette={bg=Color3.fromRGB(15,20,32),panel=Color3.fromRGB(24,31,47),row=Color3.fromRGB(32,41,59),
    ink=Color3.fromRGB(240,244,255),sub=Color3.fromRGB(150,168,192),accent=Color3.fromRGB(75,126,240),
    off=Color3.fromRGB(65,74,96),on=Color3.fromRGB(37,159,123)}
local function round(o,r) new('UICorner',{CornerRadius=UDim.new(0,r or 9)},o) end
local function label(text,sz,bold,parent)
    return new('TextLabel',{BackgroundTransparency=1,Text=text,Font=bold and Enum.Font.GothamBold or Enum.Font.Gotham,
        TextSize=sz,TextColor3=palette.ink,TextXAlignment=Enum.TextXAlignment.Left,TextYAlignment=Enum.TextYAlignment.Center},parent)
end
local function button(text,parent,color)
    local b=new('TextButton',{BackgroundColor3=color or palette.accent,Text=text,TextColor3=palette.ink,
        Font=Enum.Font.GothamBold,TextSize=13,AutoButtonColor=true,BorderSizePixel=0},parent)
    round(b,8);return b
end
openButton=button('LAB',rootGui,palette.accent)
openButton.Name='open_menu';openButton.Size=UDim2.fromOffset(62,45)
openButton.Position=UDim2.fromOffset(14,130);openButton.ZIndex=90
main=new('Frame',{Name='main_menu',Size=UDim2.fromOffset(610,480),Position=UDim2.new(.5,-305,.5,-240),
    BackgroundColor3=palette.bg,BorderSizePixel=0,ClipsDescendants=true},rootGui)
round(main,13)
new('UIStroke',{Color=Color3.fromRGB(70,83,120),Thickness=1,Transparency=.24},main)
local top=new('Frame',{BackgroundColor3=palette.panel,Size=UDim2.new(1,0,0,54),BorderSizePixel=0},main)
local name=label('UNIVERSAL SECURITY LAB',17,true,top)
name.Position=UDim2.fromOffset(18,5);name.Size=UDim2.new(1,-145,0,29)
local by=label('Client-side tests  •  private place only',11,false,top)
by.TextColor3=palette.sub;by.Position=UDim2.fromOffset(18,30);by.Size=UDim2.new(1,-140,0,18)
local close=button('X',top,palette.off);close.Size=UDim2.fromOffset(35,32)
close.Position=UDim2.new(1,-45,0,11)
local tabBar=new('ScrollingFrame',{BackgroundTransparency=1,Size=UDim2.new(1,-20,0,47),
    Position=UDim2.fromOffset(10,60),ScrollBarThickness=0,ScrollingDirection=Enum.ScrollingDirection.X,CanvasSize=UDim2.fromOffset(0,0)},main)
local tabsLayout=new('UIListLayout',{FillDirection=Enum.FillDirection.Horizontal,Padding=UDim.new(0,6),SortOrder=Enum.SortOrder.LayoutOrder},tabBar)
local body=new('Frame',{BackgroundTransparency=1,Position=UDim2.fromOffset(12,111),Size=UDim2.new(1,-24,1,-152)},main)
statusText=label('Ready | toggle any feature individually',11,false,main)
statusText.Position=UDim2.new(0,14,1,-34);statusText.Size=UDim2.new(1,-28,0,25)
statusText.TextColor3=palette.sub
local pages={}
local tabBtns={}
local function selectPage(n)
    for k,p in pairs(pages) do p.Visible=(k==n) end
    for k,b in pairs(tabBtns) do b.BackgroundColor3=k==n and palette.accent or palette.row end
end
local order={'MOVE','PHYSICS','VISUAL','INTERACT','COMBAT','TOOLS'}
for i,n in ipairs(order) do
    local tb=button(n,tabBar,palette.row);tb.LayoutOrder=i;tb.Size=UDim2.fromOffset(n=='INTERACT' and 96 or 88,35)
    tabBtns[n]=tb
    local page=new('ScrollingFrame',{Name=n,Size=UDim2.fromScale(1,1),BackgroundTransparency=1,
        BorderSizePixel=0,CanvasSize=UDim2.new(),AutomaticCanvasSize=Enum.AutomaticSize.Y,
        ScrollBarThickness=4,ScrollBarImageColor3=palette.accent,Visible=false},body)
    new('UIListLayout',{Padding=UDim.new(0,7),SortOrder=Enum.SortOrder.LayoutOrder},page)
    new('UIPadding',{PaddingTop=UDim.new(0,3),PaddingRight=UDim.new(0,8),PaddingBottom=UDim.new(0,6)},page)
    pages[n]=page
    track(tb.Activated:Connect(function() selectPage(n) end))
end
track(tabsLayout:GetPropertyChangedSignal('AbsoluteContentSize'):Connect(function()
    tabBar.CanvasSize=UDim2.fromOffset(tabsLayout.AbsoluteContentSize.X+8,0)
end))
local rowCount=0
local function row(page,title,desc)
    rowCount=rowCount+1
    local r=new('Frame',{BackgroundColor3=palette.row,Size=UDim2.new(1,-2,0,57),LayoutOrder=rowCount,BorderSizePixel=0},pages[page])
    round(r,8)
    local t=label(title,14,true,r);t.Position=UDim2.fromOffset(12,4);t.Size=UDim2.new(1,-134,0,28)
    local d=label(desc,11,false,r);d.TextColor3=palette.sub
    d.Position=UDim2.fromOffset(12,30);d.Size=UDim2.new(1,-134,0,20)
    return r
end
local function toggle(page,key,title,desc)
    local r=row(page,title,desc)
    local b=button('OFF',r,palette.off);b.Size=UDim2.fromOffset(76,34);b.Position=UDim2.new(1,-88,.5,-17)
    togglesUI[key]=b;S[key]=false
    track(b.Activated:Connect(function() setToggle(key,not S[key]) end))
end
local function action(page,title,desc,callback)
    local r=row(page,title,desc)
    local b=button('RUN',r,palette.accent);b.Size=UDim2.fromOffset(76,34);b.Position=UDim2.new(1,-88,.5,-17)
    track(b.Activated:Connect(function() safe(callback) end))
    return b
end
local function valueRow(page,key,title,lo,hi,step)
    rowCount=rowCount+1
    local r=new('Frame',{BackgroundColor3=palette.panel,Size=UDim2.new(1,-2,0,42),LayoutOrder=rowCount,BorderSizePixel=0},pages[page]);round(r,8)
    local l=label(title,12,false,r);l.Position=UDim2.fromOffset(12,0);l.Size=UDim2.new(1,-215,1,0)
    local minus=button('-',r,palette.off);minus.Size=UDim2.fromOffset(32,29);minus.Position=UDim2.new(1,-168,.5,-14.5)
    local v=label(tostring(cfg[key]),13,true,r);v.TextXAlignment=Enum.TextXAlignment.Center
    v.Position=UDim2.new(1,-130,.5,-14);v.Size=UDim2.fromOffset(75,29)
    local plus=button('+',r,palette.off);plus.Size=UDim2.fromOffset(32,29);plus.Position=UDim2.new(1,-43,.5,-14.5)
    local function change(d)
        cfg[key]=math.clamp(cfg[key]+d,lo,hi);v.Text=tostring(cfg[key])
        status(title..' = '..cfg[key])
    end
    track(minus.Activated:Connect(function() change(-step) end))
    track(plus.Activated:Connect(function() change(step) end))
end
local function textRow(page,title,hint,initial)
    rowCount=rowCount+1
    local r=new('Frame',{BackgroundColor3=palette.panel,Size=UDim2.new(1,-2,0,44),LayoutOrder=rowCount,BorderSizePixel=0},pages[page]);round(r,8)
    local l=label(title,12,false,r);l.Position=UDim2.fromOffset(12,0);l.Size=UDim2.new(.4,0,1,0)
    local field=new('TextBox',{Size=UDim2.new(.55,-12,0,31),Position=UDim2.new(.45,0,.5,-15.5),
        BackgroundColor3=palette.row,BorderSizePixel=0,TextColor3=palette.ink,TextSize=13,
        Font=Enum.Font.Gotham,PlaceholderText=hint,Text=initial or '',ClearTextOnFocus=false},r)
    round(field,6);return field
end

-- MOVE
valueRow('MOVE','speed','Walk speed (studs/s)',16,250,8)
toggle('MOVE','speed','Speed Hack','Continuous local WalkSpeed override')
valueRow('MOVE','jump','Jump power',50,300,10)
toggle('MOVE','jump','Jump Power','Higher jump; supports R6 and R15')
valueRow('MOVE','fly','Fly speed',15,200,10)
toggle('MOVE','fly','Fly','WASD + Space / LeftCtrl; camera-relative')
toggle('MOVE','noclip','Noclip','Disable character collisions locally')
toggle('MOVE','infJump','Infinite Jump','Press jump while airborne')
valueRow('MOVE','gravity','World gravity',0,196,15)
toggle('MOVE','gravity','Gravity Override','Change local Workspace gravity')
toggle('MOVE','bhop','Bunny Hop','Automatic ground jumps while moving')
toggle('MOVE','airwalk','Air Walk','Invisible local platform under feet')
toggle('MOVE','spinbot','Spinbot','Rotate character continuously')
toggle('MOVE','antiRagdoll','Anti Ragdoll','Disable local ragdoll/falling states')
toggle('MOVE','clickTP','Click Teleport','Close menu then click an object/ground')
local xyz=textRow('MOVE','Coordinates','X, Y, Z','0, 20, 0')
action('MOVE','Teleport to coordinates','Enter comma-separated X,Y,Z above',function()
    local a,b,c=string.match(xyz.Text,'^%s*([%-%d%.]+)%s*,%s*([%-%d%.]+)%s*,%s*([%-%d%.]+)%s*$')
    if a and b and c and tonumber(a) and tonumber(b) and tonumber(c) then
        tpTo(Vector3.new(tonumber(a),tonumber(b),tonumber(c)))
    else status('Bad XYZ format') end
end)

-- PHYSICS
valueRow('PHYSICS','fling','Spin intensity',70,350,20)
toggle('PHYSICS','fling','Fling / Spin Physics','Attempt character angular-velocity fling')
toggle('PHYSICS','antiFling','Anti Fling','Limit extreme velocity, remove peer collisions')
action('PHYSICS','Push center-targeted part','Only unanchored physics parts can move',function()
    local t=getCenterTarget();local cam=camera()
    if not t or not t:IsA('BasePart') or t.Anchored then status('Aim at an unanchored part');return end
    safe(function() t:ApplyImpulse(cam.CFrame.LookVector*t.AssemblyMass*100) end)
    status('Impulse attempted: '..t:GetFullName())
end)
toggle('PHYSICS','grab','Physics Grab','Close menu: left-click part, release to drop')
valueRow('PHYSICS','grabDistance','Grab distance',6,40,2)
toggle('PHYSICS','vehicleSpeed','Vehicle Speed','Boost seated vehicle assembly velocity')
valueRow('PHYSICS','vehicle','Vehicle speed',50,300,10)
toggle('PHYSICS','vehicleFly','Vehicle Fly','Steer seat with WASD + Space/Ctrl')

-- VISUAL
valueRow('VISUAL','fov','Aimbot FOV radius (px)',30,600,30)
toggle('VISUAL','playerESP','Player ESP','Highlights, names and distances through walls')
toggle('VISUAL','tracers','Player Tracers','Lines to on-screen players')
toggle('VISUAL','itemESP','Item ESP','Workspace Tools and tagged loot/pickups')
toggle('VISUAL','fullbright','Fullbright','Local lighting override')
toggle('VISUAL','xray','X-Ray Map','Transparent anchored parts (up to 3500)')
toggle('VISUAL','zoom','Zoom Unlock','Camera maximum zoom 500')
toggle('VISUAL','freecam','Freecam','WASD/QE; hold right-click and drag to look')
valueRow('VISUAL','freecam','Freecam speed',10,180,10)
local targetName=textRow('VISUAL','Target player','Username prefix','')
action('VISUAL','Spectate target','Follow entered player using camera',function() doSpectate(targetName.Text) end)
action('VISUAL','Reset camera','Leave spectate/freecam',function()
    setToggle('freecam',false)
    local _,h=root();local cam=camera();if cam and h then cam.CameraType=Enum.CameraType.Custom;cam.CameraSubject=h end
    status('Camera reset')
end)

-- INTERACT
valueRow('INTERACT','range','Test reach (studs)',10,200,10)
toggle('INTERACT','instantPrompt','Instant Prompt','Client HoldDuration = 0')
toggle('INTERACT','promptReach','Prompt Reach','Client MaxActivationDistance override')
toggle('INTERACT','promptLOS','Prompt Wall Check','Client RequiresLineOfSight = false')
toggle('INTERACT','autoPrompt','Auto Prompt','Trigger nearest prompt once per 1.2 seconds')
action('INTERACT','Trigger nearest prompt','One manual interaction attempt',tryPrompt)
toggle('INTERACT','autoPickup','Auto Pickup','Nearby workspace Tools (touch API required)')
toggle('INTERACT','autoEquip','Auto Equip Tool','Equip first backpack tool periodically')
valueRow('INTERACT','clickRate','Auto click / sec',1,15,1)
toggle('INTERACT','autoClick','Auto Clicker','Send clicks or activate equipped Tool')
toggle('INTERACT','antiAFK','Anti AFK','Simulate input on Idled')

-- COMBAT
valueRow('COMBAT','hitbox','Hitbox width',2,16,1)
toggle('COMBAT','aimbot','Aimbot','Hold right mouse to track closest target')
toggle('COMBAT','triggerbot','Triggerbot','Click when camera center points at player')
toggle('COMBAT','hitbox','Hitbox Expander','Local target head size modification')
valueRow('COMBAT','reach','Tool reach size',4,30,2)
toggle('COMBAT','reach','Reach','Local equipped Handle size change')
toggle('COMBAT','rapid','Rapid Tool','Repeated Tool:Activate while enabled')
valueRow('COMBAT','aura','Aura distance',5,35,2)
toggle('COMBAT','aura','Kill Aura','Auto-activate equipped Tool by nearby enemy')
toggle('COMBAT','recoil','Camera Recoil Lock','Brief local camera orientation stabilization')

-- TOOLS
local playerField=textRow('TOOLS','Player to teleport','Username prefix','')
action('TOOLS','Teleport to player','Target must be loaded in Workspace',function()
    local q=string.lower(playerField.Text)
    for _,p in ipairs(Players:GetPlayers()) do
        if p~=localPlayer and q~='' and p.Name:lower():sub(1,#q)==q then
            local r=p.Character and p.Character:FindFirstChild('HumanoidRootPart')
            if r then tpTo(r.Position+Vector3.new(3,0,0));status('Teleported toward '..p.Name) else status('Player character missing') end
            return
        end
    end
    status('Player not found')
end)
action('TOOLS','List client-visible Remotes','Read-only; print all Remote paths to console',trackedRemoteScan)
action('TOOLS','Read Points','Display current client-visible Points',scanPlayerPoints)
action('TOOLS','Restore all modifications','Switch OFF every feature, restore properties',function()
    local keys={};for k in pairs(S) do table.insert(keys,k) end
    for _,k in ipairs(keys) do setToggle(k,false) end
    status('All features switched off')
end)
local stopButton=action('TOOLS','Unload Security Lab','Remove GUI, stop all loops and restore',function() if type(store.__SEC_LAB_STOP)=='function' then store.__SEC_LAB_STOP() end end)
stopButton.Text='STOP'
selectPage('MOVE')
track(openButton.Activated:Connect(function() main.Visible=not main.Visible end))
track(close.Activated:Connect(function() main.Visible=false end))
local dragging=false;local dragStart,dragPosition
track(top.InputBegan:Connect(function(input)
    if input.UserInputType==Enum.UserInputType.MouseButton1 or input.UserInputType==Enum.UserInputType.Touch then
        dragging=true;dragStart=input.Position;dragPosition=main.Position
    end
end))
track(UIS.InputChanged:Connect(function(input)
    if dragging and (input.UserInputType==Enum.UserInputType.MouseMovement or input.UserInputType==Enum.UserInputType.Touch) then
        local d=input.Position-dragStart
        main.Position=UDim2.new(dragPosition.X.Scale,dragPosition.X.Offset+d.X,dragPosition.Y.Scale,dragPosition.Y.Offset+d.Y)
    end
end))
track(UIS.InputEnded:Connect(function(input)
    if input.UserInputType==Enum.UserInputType.MouseButton1 or input.UserInputType==Enum.UserInputType.Touch then dragging=false end
end))

-- Inputs
local recoilUntil,recoilCamera
track(UIS.InputBegan:Connect(function(input,gpe)
    if input.KeyCode==Enum.KeyCode.RightShift then main.Visible=not main.Visible return end
    if gpe then return end
    if input.UserInputType==Enum.UserInputType.MouseButton2 then rightHeld=true end
    if input.UserInputType==Enum.UserInputType.MouseButton1 then
        leftHeld=true
        if S.recoil then recoilUntil=os.clock()+.14;recoilCamera=camera() and camera().CFrame end
    end
end))
track(UIS.InputEnded:Connect(function(input)
    if input.UserInputType==Enum.UserInputType.MouseButton2 then rightHeld=false end
    if input.UserInputType==Enum.UserInputType.MouseButton1 then leftHeld=false;disableGrab() end
end))
track(UIS.JumpRequest:Connect(function()
    if S.infJump then
        local _,h=root();if h then h:ChangeState(Enum.HumanoidStateType.Jumping) end
    end
end))
track(mouse.Button1Down:Connect(function()
    if main.Visible then return end
    local pt=UIS:GetMouseLocation()
    if viewportHit(openButton,pt.X,pt.Y) then return end
    if S.clickTP then
        local hit=mouse.Hit
        if hit then tpTo(hit.Position) end
    elseif S.grab then
        local part=mouse.Target
        if part and part:IsA('BasePart') and not part.Anchored and not (localPlayer.Character and part:IsDescendantOf(localPlayer.Character)) then
            disableGrab();grabbedPart=part
            grabBP=Instance.new('BodyPosition');grabBP.Name='sec_lab_grab_force'
            grabBP.MaxForce=Vector3.new(1e7,1e7,1e7);grabBP.P=10000;grabBP.D=1300
            grabBP.Position=part.Position;grabBP.Parent=part
            status('Grab test: '..part.Name)
        end
    end
end))
track(localPlayer.Idled:Connect(function()
    if S.antiAFK then safe(function()
        VirtualUser:CaptureController()
        VirtualUser:Button2Down(Vector2.new(0,0),camera().CFrame)
        task.wait(.1)
        VirtualUser:Button2Up(Vector2.new(0,0),camera().CFrame)
    end) end
end))

-- Render-side mechanisms
local lastCamRot = 0
track(RunService.RenderStepped:Connect(function(dt)
    if not alive then return end
    local c,h,r=root();local cam=camera();if not cam then return end
    if S.tracers then safe(drawLines) end
    if S.grab and grabBP and grabbedPart then
        if grabbedPart.Parent then grabBP.Position=cam.CFrame.Position+cam.CFrame.LookVector*cfg.grabDistance
        else disableGrab() end
    end
    if S.fly and r and h then
        ensureFly()
        local direction=Vector3.zero
        local flatFront=Vector3.new(cam.CFrame.LookVector.X,0,cam.CFrame.LookVector.Z)
        local flatRight=Vector3.new(cam.CFrame.RightVector.X,0,cam.CFrame.RightVector.Z)
        if flatFront.Magnitude>.01 then flatFront=flatFront.Unit end
        if flatRight.Magnitude>.01 then flatRight=flatRight.Unit end
        if UIS:IsKeyDown(Enum.KeyCode.W) then direction=direction+flatFront end
        if UIS:IsKeyDown(Enum.KeyCode.S) then direction=direction-flatFront end
        if UIS:IsKeyDown(Enum.KeyCode.D) then direction=direction+flatRight end
        if UIS:IsKeyDown(Enum.KeyCode.A) then direction=direction-flatRight end
        if h.MoveDirection.Magnitude>.15 and direction.Magnitude<.01 then direction=direction+h.MoveDirection end
        if UIS:IsKeyDown(Enum.KeyCode.Space) or UIS:IsKeyDown(Enum.KeyCode.E) then direction=direction+Vector3.yAxis end
        if UIS:IsKeyDown(Enum.KeyCode.LeftControl) or UIS:IsKeyDown(Enum.KeyCode.Q) then direction=direction-Vector3.yAxis end
        if direction.Magnitude>1 then direction=direction.Unit end
        if flyBV and flyBG then
            flyBV.Velocity=direction*cfg.fly
            if flatFront.Magnitude<.01 then flatFront=Vector3.new(0,0,-1) end
            flyBG.CFrame=CFrame.lookAt(r.Position,r.Position+flatFront)
        end
    end
    if S.spinbot and r and not S.fly then r.CFrame=r.CFrame*CFrame.Angles(0,math.min(dt,.06)*cfg.spin,0) end
    if S.aimbot and rightHeld and not S.freecam then
        local p=getNearbyPlayer(1500)
        local part=p and p.Character and (p.Character:FindFirstChild('Head') or p.Character:FindFirstChild('HumanoidRootPart'))
        if part then cam.CFrame=CFrame.lookAt(cam.CFrame.Position,part.Position) end
    end
    if S.freecam then
        cam.CameraType=Enum.CameraType.Scriptable
        local mov=Vector3.zero
        if UIS:IsKeyDown(Enum.KeyCode.W) then mov=mov+cam.CFrame.LookVector end
        if UIS:IsKeyDown(Enum.KeyCode.S) then mov=mov-cam.CFrame.LookVector end
        if UIS:IsKeyDown(Enum.KeyCode.A) then mov=mov-cam.CFrame.RightVector end
        if UIS:IsKeyDown(Enum.KeyCode.D) then mov=mov+cam.CFrame.RightVector end
        if UIS:IsKeyDown(Enum.KeyCode.E) then mov=mov+Vector3.yAxis end
        if UIS:IsKeyDown(Enum.KeyCode.Q) then mov=mov-Vector3.yAxis end
        if mov.Magnitude>1 then mov=mov.Unit end
        cam.CFrame=cam.CFrame+CFrame.new(mov*cfg.freecam*dt).Position
        if rightHeld then
            local delta=UIS:GetMouseDelta()
            cam.CFrame=cam.CFrame*CFrame.Angles(-delta.Y*.003,-delta.X*.003,0)
        end
    end
    if S.recoil and recoilCamera and recoilUntil and os.clock()<recoilUntil and not S.freecam then
        cam.CFrame=CFrame.lookAt(cam.CFrame.Position,cam.CFrame.Position+recoilCamera.LookVector)
    end
end))

-- Bounded throttled updates, separated from rendering
local tickAccumulator=0
local timers={}
local function due(key,interval)
    local now=os.clock()
    if (timers[key] or 0)>now then return false end
    timers[key]=now+interval;return true
end
track(RunService.Heartbeat:Connect(function(dt)
    if not alive then return end
    local c,h,r=root()
    if due('enforce',.14) then
        if S.speed or S.jump then safe(updatePlayerSettings) end
        if S.gravity then workspace.Gravity=cfg.gravity end
        if S.noclip and c then
            for _,part in ipairs(c:GetDescendants()) do
                if part:IsA('BasePart') then addPartRestore(stash.collision,part,'CanCollide',false) end
            end
        end
        if S.airwalk and r and airPlatform then
            airPlatform.CFrame=CFrame.new(r.Position-Vector3.new(0,3.8,0))
        end
        if S.bhop and h and h.MoveDirection.Magnitude>.1 and h.FloorMaterial~=Enum.Material.Air and due('hop',.28) then
            h:ChangeState(Enum.HumanoidStateType.Jumping)
        end
        if S.antiFling and r then
            if r.AssemblyLinearVelocity.Magnitude>125 then r.AssemblyLinearVelocity=Vector3.zero end
            if r.AssemblyAngularVelocity.Magnitude>35 then r.AssemblyAngularVelocity=Vector3.zero end
        end
        if S.fling and r then r.AssemblyAngularVelocity=Vector3.new(0,cfg.fling,0) end
        if h and h.SeatPart and h.SeatPart:IsA('VehicleSeat') then
            local seat=h.SeatPart
            if S.vehicleSpeed then
                local old=seat.AssemblyLinearVelocity
                seat.AssemblyLinearVelocity=seat.CFrame.LookVector*(cfg.vehicle*seat.ThrottleFloat)+Vector3.new(0,old.Y,0)
            end
            if S.vehicleFly then
                local cam=camera();local move=Vector3.zero
                if UIS:IsKeyDown(Enum.KeyCode.W) then move=move+cam.CFrame.LookVector end
                if UIS:IsKeyDown(Enum.KeyCode.S) then move=move-cam.CFrame.LookVector end
                if UIS:IsKeyDown(Enum.KeyCode.Space) then move=move+Vector3.yAxis end
                if UIS:IsKeyDown(Enum.KeyCode.LeftControl) then move=move-Vector3.yAxis end
                seat.AssemblyLinearVelocity=move.Magnitude>.1 and move.Unit*cfg.vehicle or Vector3.zero
            end
        end
    end
    if due('half',.45) then
        if S.playerESP then safe(refreshESP) end
        if S.antiRagdoll then safe(antiRagdoll) end
        if S.hitbox then safe(applyHitboxes) end
        if S.reach then safe(applyReach) end
        if S.antiFling then
            for _,p in ipairs(Players:GetPlayers()) do
                if p~=localPlayer and p.Character then
                    for _,part in ipairs(p.Character:GetDescendants()) do
                        if part:IsA('BasePart') then addPartRestore(stash.otherCollisions,part,'CanCollide',false) end
                    end
                end
            end
        end
        if S.fullbright then
            Lighting.Brightness=4;Lighting.ClockTime=12;Lighting.Ambient=Color3.new(1,1,1)
            Lighting.OutdoorAmbient=Color3.new(1,1,1);Lighting.FogEnd=100000
            Lighting.ExposureCompensation=.5;Lighting.GlobalShadows=false
        end
    end
    if due('prompt',2) and (S.instantPrompt or S.promptReach or S.promptLOS) then safe(applyPrompts) end
    if due('item',4) and S.itemESP then safe(refreshItems) end
    if S.autoPrompt and due('autoPrompt',1.2) then safe(tryPrompt) end
    if S.autoPickup and due('pickup',1.5) then safe(tryPickup) end
    if S.autoEquip and due('equip',1) and h and not localTools() then
        local bag=localPlayer:FindFirstChildOfClass('Backpack')
        local tool=bag and bag:FindFirstChildOfClass('Tool')
        if tool then safe(function() h:EquipTool(tool) end) end
    end
    if S.autoClick and due('click',1/cfg.clickRate) then pressClick() end
    if S.rapid and due('rapid',.09) then
        local tool=localTools();if tool then safe(function() tool:Activate() end) end
    end
    if S.aura and due('aura',.22) and r then
        for _,p in ipairs(Players:GetPlayers()) do
            if p~=localPlayer and p.Character and (not localPlayer.Team or p.Team~=localPlayer.Team) then
                local other=p.Character:FindFirstChild('HumanoidRootPart')
                if other and (other.Position-r.Position).Magnitude<=cfg.aura then
                    local tool=localTools();if tool then safe(function() tool:Activate() end) end
                    break
                end
            end
        end
    end
    if S.triggerbot and due('trigger',.22) then
        local part=getCenterTarget()
        if part then
            local node=part;local p=nil
            while node and node~=workspace do
                if node:IsA('Model') then p=Players:GetPlayerFromCharacter(node);if p then break end end
                node=node.Parent
            end
            if p and p~=localPlayer and (not localPlayer.Team or p.Team~=localPlayer.Team) then pressClick() end
        end
    end
end))

local function stop()
    if not alive then return end
    alive=false
    for k,v in pairs(S) do
        if v then S[k]=false;safe(function() undoToggle(k) end) end
    end
    removeFly();disableGrab()
    for _,c in ipairs(connections) do pcall(function() c:Disconnect() end) end
    if airPlatform then airPlatform:Destroy();airPlatform=nil end
    for p,e in pairs(playerHighlights) do if e.h then e.h:Destroy() end if e.bill then e.bill:Destroy() end end
    for p,e in pairs(itemHighlights) do if e.h then e.h:Destroy() end if e.b then e.b:Destroy() end end
    for _,f in pairs(lineFrames) do f:Destroy() end
    if rootGui then rootGui:Destroy() end
    if store.__SEC_LAB_STOP==stop then store.__SEC_LAB_STOP=nil end
    print('[SEC LAB] unloaded, client properties restored where possible')
end
store.__SEC_LAB_STOP=stop
status('READY | LAB / RightShift | '..rowCount..' individual rows')
print('[SEC LAB] Universal Security Lab v1.0 loaded. Client-only effects DO NOT prove server exploits.')
print('[SEC LAB] Executor: firetouchinterest='..tostring(hasTouch)..', fireproximityprompt='..tostring(hasPrompt)..', mouse1click='..tostring(canClick))