Cristsx

Prison life script

Jan 17th, 2026 (edited)
931
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 62.09 KB | None | 0 0
  1. --====================================================
  2. -- PRISON LIFE | DELTA MOBILE | SCRIPT FINAL (Tremor ao pegar armas + ESP robusto)
  3. -- Cole como LocalScript em StarterPlayer -> StarterPlayerScripts
  4. --====================================================
  5.  
  6. -- Services
  7. local Players = game:GetService("Players")
  8. local RunService = game:GetService("RunService")
  9. local Workspace = game:GetService("Workspace")
  10. local UserInputService = game:GetService("UserInputService")
  11. local TweenService = game:GetService("TweenService")
  12. local HttpService = game:GetService("HttpService")
  13. local TeleportService = game:GetService("TeleportService")
  14. local Lighting = game:GetService("Lighting")
  15.  
  16. local LP = Players.LocalPlayer
  17. repeat task.wait() until LP
  18. local PlayerGui = LP:WaitForChild("PlayerGui")
  19. local Camera = Workspace.CurrentCamera
  20.  
  21. -- Feature detection
  22. local HAS_DRAWING = pcall(function() return typeof(Drawing) == "table" end)
  23. local HAS_RAWMT = pcall(function() return getrawmetatable and getrawmetatable(game) end)
  24. local HAS_NEWC = type(newcclosure) == "function"
  25. local HAS_FILE = (type(writefile)=="function" and type(readfile)=="function" and type(isfile)=="function")
  26. local CAN_HOOK = HAS_RAWMT and HAS_NEWC
  27.  
  28. -- ================= SETTINGS (default: tudo OFF)
  29. local Settings = {
  30.     SilentAim = false,
  31.     ShowFOV = false,
  32.     FOVRadius = 135,
  33.     TargetPart = "Head",
  34.     ESP = false,
  35.     ESP_Name = false,
  36.     ESP_Health = false,
  37.     ESP_Line = false,
  38.     ErrarTiros = false,
  39.     ErrarBase = 0.26,
  40.     ErrarMax = 0.45,
  41.     ErrarJitter = 0.07,
  42.     ErrarDistWeight = 0.12,
  43.     ErrarTargetMoveWeight = 0.18,
  44.     ErrarLocalMoveWeight = 0.12,
  45.     ErrarCamMoveWeight = 0.12,
  46.     ErrarShotStreakWeight = 0.05,
  47.     ErrarShotWindow = 1.2,
  48.     DelayFarTargets = false,
  49.     DelayMean = 0.35,
  50.     DelayJitter = 0.15,
  51.     AutoPickWeapons = false,
  52.     Mods_Weapons = { MP5=false, REMINGTON=false, M4A1=false, FAL=false, ["AK-47"]=false },
  53.     TeamFilterEnabled = false,
  54.     TeamFilter = { Guards=false, Inmates=false, Criminals=false },
  55.     AutoLoadConfigs = false,
  56.     Optimization = false,
  57.     AutoReload = true,
  58. }
  59.  
  60. local SilentAimSettings = {
  61.     MaxDistance = 600,
  62.     MISS_OFFSET_BASE = 1.6,
  63.     PERSISTENCE_TIME = 1.0
  64. }
  65.  
  66. -- ================= STATE
  67. local shotsFired = 0
  68. local targetEnterTime = {}
  69. local targetDeadline = {}
  70. local currentPlayer = nil
  71. local currentTargetPart = nil
  72. local lastSwitch = 0
  73.  
  74. local deviationState = {}
  75. local recentShots = {}
  76. local perTargetProb = {}
  77. local camAngularSpeed = 0
  78. local lastCameraCFrame = Camera and Camera.CFrame or nil
  79.  
  80. local cachedMissProb = 0
  81. local cachedMissTarget = nil
  82.  
  83. -- ================= TELEPORTS / PICK LOCS
  84. local TELEPORT_CFRAMES = {
  85.     MP5 = CFrame.new(813.77771, 101, 2229.31494, -0.223565266, 1.63104605e-08, 0.974688947, -1.0040615e-09, 1, -1.69643197e-08, -0.974688947, -4.77128026e-09, -0.223565266),
  86.     REMINGTON = CFrame.new(819.945129, 101, 2229.5896, -0.304979891, 2.46256828e-08, -0.952358782, 5.93047815e-08, 1, 6.86602286e-09, 0.952358782, -5.43854313e-08, -0.304979891),
  87.     M4A1 = CFrame.new(847.449097, 101, 2229.58618, 0.622228265, 1.86408489e-08, -0.782835841, -9.01549129e-08, 1, -4.78466653e-08, 0.782835841, 1.00348046e-07, 0.622228265),
  88.     FAL = CFrame.new(-915.726562, 94.3527985, 2047.32214, -0.305260807, -8.88391725e-08, -0.952268779, -5.00594268e-08, 1, -7.72449908e-08, 0.952268779, 2.4090161e-08, -0.305260807),
  89.     ["AK-47"] = CFrame.new(-939.100769, 94.4282608, 2039.23157, 0.630430043, -3.7999687e-08, 0.776246071, 2.66730336e-08, 1, 2.72905805e-08, -0.776246071, 3.50003582e-09, 0.630430043)
  90. }
  91. local LOCATION_CFRAMES = {
  92.     ["Criminal Base"] = CFrame.new(-937.829041, 94.1288528, 2059.24487, 0.0922517404, 1.40339107e-09, -0.995735705, 8.31396285e-09, 1, 2.17966334e-09, 0.995735705, -8.47958681e-09, 0.0922517404),
  93.     ["Telhado"] = CFrame.new(959.683105, 133.636993, 2267.60449, -0.908200383, 4.79157087e-08, 0.41853565, 6.11828739e-08, 1, 1.82794473e-08, -0.41853565, 4.22086153e-08, -0.908200383),
  94.     ["Cafeteria"] = CFrame.new(907.480286, 99.9899521, 2253.39209, 0.992569506, 0, 0.121679187, 0, 1, 0, -0.121679187, 0, 0.992569506)
  95. }
  96.  
  97. -- ================= OPTIMIZATION
  98. local optimizationStore = { lighting = {}, partsCastShadow = {}, emittersEnabled = {}, lightsSettings = {}, otherEffects = {} }
  99. local optimizationApplied = false
  100. local function applyOptimization(enable)
  101.     if enable == optimizationApplied then return end
  102.     if enable then
  103.         pcall(function()
  104.             optimizationStore.lighting.GlobalShadows = Lighting.GlobalShadows
  105.             optimizationStore.lighting.Brightness = Lighting.Brightness
  106.             optimizationStore.lighting.Ambient = Lighting.Ambient
  107.             optimizationStore.lighting.OutdoorAmbient = Lighting.OutdoorAmbient
  108.             optimizationStore.lighting.FogEnd = Lighting.FogEnd
  109.         end)
  110.         pcall(function()
  111.             Lighting.GlobalShadows = false
  112.             Lighting.Brightness = math.max(1, (optimizationStore.lighting.Brightness or 1))
  113.             Lighting.Ambient = Color3.fromRGB(185,185,185)
  114.             Lighting.OutdoorAmbient = Color3.fromRGB(170,170,170)
  115.             Lighting.FogEnd = 1e6
  116.         end)
  117.         for _,inst in ipairs(Workspace:GetDescendants()) do
  118.             if inst:IsA("BasePart") then optimizationStore.partsCastShadow[inst] = inst.CastShadow; pcall(function() inst.CastShadow = false end) end
  119.             if inst:IsA("ParticleEmitter") or inst:IsA("Trail") or inst:IsA("Beam") or inst:IsA("Sparkles") or inst:IsA("Fire") or inst:IsA("Smoke") then optimizationStore.emittersEnabled[inst] = inst.Enabled; pcall(function() inst.Enabled = false end) end
  120.             if inst:IsA("PointLight") or inst:IsA("SpotLight") or inst:IsA("SurfaceLight") then optimizationStore.lightsSettings[inst] = {Brightness = inst.Brightness, Range = inst.Range}; pcall(function() inst.Brightness = 0; inst.Range = 0 end) end
  121.         end
  122.         optimizationApplied = true
  123.     else
  124.         pcall(function()
  125.             if optimizationStore.lighting.GlobalShadows ~= nil then Lighting.GlobalShadows = optimizationStore.lighting.GlobalShadows end
  126.             if optimizationStore.lighting.Brightness ~= nil then Lighting.Brightness = optimizationStore.lighting.Brightness end
  127.             if optimizationStore.lighting.Ambient ~= nil then Lighting.Ambient = optimizationStore.lighting.Ambient end
  128.             if optimizationStore.lighting.OutdoorAmbient ~= nil then Lighting.OutdoorAmbient = optimizationStore.lighting.OutdoorAmbient end
  129.             if optimizationStore.lighting.FogEnd ~= nil then Lighting.FogEnd = optimizationStore.lighting.FogEnd end
  130.         end)
  131.         for inst,prev in pairs(optimizationStore.partsCastShadow) do pcall(function() if inst and inst:IsA("BasePart") then inst.CastShadow = prev end end) end
  132.         optimizationStore.partsCastShadow = {}
  133.         for inst,prev in pairs(optimizationStore.emittersEnabled) do pcall(function() if inst and inst:IsA("ParticleEmitter") then inst.Enabled = prev end end) end
  134.         optimizationStore.emittersEnabled = {}
  135.         for inst,prev in pairs(optimizationStore.lightsSettings) do pcall(function() if inst and (inst:IsA("PointLight") or inst:IsA("SpotLight") or inst:IsA("SurfaceLight")) then inst.Brightness = prev.Brightness; inst.Range = prev.Range end end) end
  136.         optimizationStore.lightsSettings = {}
  137.         optimizationApplied = false
  138.     end
  139. end
  140.  
  141. -- ================= UTILITIES
  142. local function getHumanoid(char) return char and char:FindFirstChildOfClass("Humanoid") end
  143. local function inFront(pos) return Camera and Camera.CFrame and Camera.CFrame:PointToObjectSpace(pos).Z < 0 end
  144.  
  145. local function getTargetPartFromChar(char)
  146.     if not char then return nil end
  147.     local head = char:FindFirstChild("Head")
  148.     local torso = char:FindFirstChild("UpperTorso") or char:FindFirstChild("Torso")
  149.     if Settings.TargetPart == "Head" then return head
  150.     elseif Settings.TargetPart == "Torso" then return torso
  151.     else
  152.         if math.random() <= 0.6 then return head or torso else return torso or head end
  153.     end
  154. end
  155.  
  156. local function getWeaponOrigin()
  157.     if LP.Character then
  158.         local tool = LP.Character:FindFirstChildOfClass("Tool")
  159.         if tool then
  160.             local handle = tool:FindFirstChild("Handle") or tool:FindFirstChild("Muzzle") or tool:FindFirstChild("Barrel")
  161.             if not handle then for _,v in ipairs(tool:GetChildren()) do if v:IsA("BasePart") then handle = v; break end end end
  162.             if handle and handle:IsA("BasePart") then return handle.Position end
  163.         end
  164.         local hrp = LP.Character:FindFirstChild("HumanoidRootPart") or LP.Character:FindFirstChild("Torso") or LP.Character:FindFirstChild("Head")
  165.         if hrp then return hrp.Position end
  166.     end
  167.     if Camera and Camera.CFrame then return Camera.CFrame.Position end
  168.     return Vector3.new()
  169. end
  170.  
  171. local function hasClearShot(part)
  172.     if not part then return false end
  173.     local origin = getWeaponOrigin()
  174.     local params = RaycastParams.new()
  175.     params.FilterType = Enum.RaycastFilterType.Blacklist
  176.     params.FilterDescendantsInstances = {LP.Character}
  177.     local dir = part.Position - origin
  178.     local ok, r = pcall(function() return Workspace:Raycast(origin, dir, params) end)
  179.     if ok and r and r.Instance and r.Instance:IsDescendantOf(part.Parent) then return true end
  180.     return false
  181. end
  182.  
  183. local function computeLateralOffset(targetPos, sideMultiplier)
  184.     if not targetPos or not Camera then return Vector3.new() end
  185.     local dist = (targetPos - Camera.CFrame.Position).Magnitude
  186.     local base = SilentAimSettings.MISS_OFFSET_BASE
  187.     local mag = math.clamp((dist/200) * base + 0.4, 0.4, base*2)
  188.     local right = Camera.CFrame.RightVector
  189.     local side = sideMultiplier or ((math.random() < 0.5) and -1 or 1)
  190.     local up = Camera.CFrame.UpVector * (math.random(-30,30)/100)
  191.     return (right * (side * mag)) + up
  192. end
  193.  
  194. local function passesTeamFilter(p)
  195.     if not p or not p.Team then
  196.         if Settings.TeamFilterEnabled then
  197.             local any=false
  198.             for k,v in pairs(Settings.TeamFilter) do if v then any=true; break end end
  199.             if any then return false end
  200.         end
  201.         return true
  202.     end
  203.     if not Settings.TeamFilterEnabled then
  204.         if LP.Team and p.Team and LP.Team == p.Team then return false end
  205.         return true
  206.     end
  207.     return Settings.TeamFilter[p.Team.Name] == true
  208. end
  209.  
  210. local function isLikelyShoot(selfArg, args, method)
  211.     if method == "Raycast" then return true end
  212.     local nm = (typeof(selfArg) == "Instance" and (selfArg.Name or ""):lower()) or ""
  213.     local keywords = {"shoot","fire","bullet","ray","projectile","replicate","weapon","fireweapon","shooting","firebullet","shootbullet"}
  214.     for _,kw in ipairs(keywords) do if string.find(nm, kw) then return true end end
  215.     for i=1,#args do
  216.         local a = args[i]
  217.         if typeof(a) == "Vector3" or typeof(a) == "CFrame" then return true end
  218.         if type(a) == "table" and a.Position then return true end
  219.     end
  220.     return false
  221. end
  222.  
  223. -- ================= TARGET SELECTION
  224. local function gatherCandidates()
  225.     local out = {}
  226.     if not Camera or not Camera.ViewportSize then return out end
  227.     local center = Camera.ViewportSize/2
  228.     local myRoot = LP.Character and LP.Character:FindFirstChild("HumanoidRootPart")
  229.     if not myRoot then return out end
  230.     for _,p in ipairs(Players:GetPlayers()) do
  231.         if p ~= LP and getHumanoid(p.Character) and getHumanoid(p.Character).Health > 0 and passesTeamFilter(p) then
  232.             local part = getTargetPartFromChar(p.Character)
  233.             if part and inFront(part.Position) and hasClearShot(part) then
  234.                 local root = p.Character:FindFirstChild("HumanoidRootPart")
  235.                 if root then
  236.                     local d = (root.Position - myRoot.Position).Magnitude
  237.                     if d <= SilentAimSettings.MaxDistance then
  238.                         local v,on = Camera:WorldToViewportPoint(part.Position)
  239.                         if on then
  240.                             local sd = (Vector2.new(v.X, v.Y) - center).Magnitude
  241.                             if sd <= Settings.FOVRadius then
  242.                                 table.insert(out, {player=p, part=part, sd=sd, dist=d, screenPos = Vector2.new(v.X, v.Y)})
  243.                             end
  244.                         end
  245.                     end
  246.                 end
  247.             end
  248.         end
  249.     end
  250.     return out
  251. end
  252.  
  253. local function isCriminalTeam(p)
  254.     if not p or not p.Team or not p.Team.Name then return false end
  255.     local name = tostring(p.Team.Name):lower()
  256.     return name:find("criminal") or name:find("crim") or name:find("bandit")
  257. end
  258.  
  259. local function pickBest(cands)
  260.     if not cands or #cands==0 then return nil end
  261.     local center = Camera.ViewportSize/2
  262.     local centerThreshold = math.max(8, math.floor(Settings.FOVRadius * 0.08))
  263.     for _,c in ipairs(cands) do
  264.         if (c.screenPos - center).Magnitude <= centerThreshold then return c end
  265.     end
  266.     table.sort(cands, function(a,b)
  267.         local ac = isCriminalTeam(a.player) and 1 or 0
  268.         local bc = isCriminalTeam(b.player) and 1 or 0
  269.         if ac ~= bc then return ac > bc end
  270.         local function hasTool(p)
  271.             if not p.Character then return false end
  272.             for _,c in ipairs(p.Character:GetChildren()) do if c:IsA("Tool") then return true end end
  273.             local bp = p:FindFirstChildOfClass("Backpack")
  274.             if bp then for _,c in ipairs(bp:GetChildren()) do if c:IsA("Tool") then return true end end end
  275.             return false
  276.         end
  277.         local aTool = hasTool(a.player) and 1 or 0
  278.         local bTool = hasTool(b.player) and 1 or 0
  279.         if aTool ~= bTool then return aTool > bTool end
  280.         if a.dist ~= b.dist then return a.dist < b.dist end
  281.         return a.sd < b.sd
  282.     end)
  283.     return cands[1]
  284. end
  285.  
  286. local function findBestTarget(precomputed)
  287.     local sel = pickBest(precomputed)
  288.     if currentPlayer and sel and sel.player ~= currentPlayer then
  289.         if tick() - lastSwitch < SilentAimSettings.PERSISTENCE_TIME then
  290.             return currentPlayer, currentTargetPart
  291.         end
  292.     end
  293.     lastSwitch = tick()
  294.     if sel then
  295.         if currentPlayer ~= sel.player then
  296.             targetEnterTime[sel.player] = tick()
  297.             local jitter = ((math.random() - 0.5) * 2) * (Settings.DelayJitter or 0.15)
  298.             local delayTime = math.max(0, (Settings.DelayMean or 0.35) + jitter)
  299.             targetDeadline[sel.player] = tick() + delayTime
  300.             deviationState[sel.player] = { idx = 0, side = (math.random()<0.5 and -1 or 1), lastFlip = tick() }
  301.         end
  302.         return sel.player, sel.part
  303.     end
  304.     return nil, nil
  305. end
  306.  
  307. -- ================= ESP (robusto, substitui versão frágil)
  308. local espCache = {}
  309.  
  310. local function safeDestroy(obj)
  311.     pcall(function()
  312.         if obj and obj.Destroy then obj:Destroy() end
  313.     end)
  314. end
  315.  
  316. local function removeDrawingLine(line)
  317.     pcall(function()
  318.         if line and line.Remove then
  319.             line.Visible = false
  320.             line:Remove()
  321.         end
  322.     end)
  323. end
  324.  
  325. local function clearESPForPlayer(p)
  326.     if not p then return end
  327.     local s = espCache[p]
  328.     if not s then return end
  329.     pcall(function()
  330.         if s.diedConn then pcall(function() s.diedConn:Disconnect() end) end
  331.         if s.highlight and s.highlight.Parent then s.highlight:Destroy() end
  332.         if s.nameGui and s.nameGui.Parent then s.nameGui:Destroy() end
  333.         if s.hpGui and s.hpGui.Parent then s.hpGui:Destroy() end
  334.         if s.line then removeDrawingLine(s.line) end
  335.     end)
  336.     espCache[p] = nil
  337. end
  338.  
  339. local function ensureESPObjectsForPlayer(p)
  340.     if not p then return end
  341.     local obj = espCache[p]
  342.     if not obj then obj = {}; espCache[p] = obj end
  343.  
  344.     -- Highlight
  345.     pcall(function()
  346.         local char = p.Character
  347.         if char and char.Parent then
  348.             local needNew = true
  349.             if obj.highlight and obj.highlight.Parent == char then needNew = false else if obj.highlight then safeDestroy(obj.highlight); obj.highlight = nil end end
  350.             if needNew then
  351.                 local ok, hl = pcall(function()
  352.                     local h = Instance.new("Highlight")
  353.                     h.Name = "DeltaESP"
  354.                     h.Parent = char
  355.                     h.FillTransparency = 0.6
  356.                     h.OutlineTransparency = 1
  357.                     return h
  358.                 end)
  359.                 if ok and hl then obj.highlight = hl end
  360.             end
  361.         else
  362.             if obj.highlight then safeDestroy(obj.highlight); obj.highlight = nil end
  363.         end
  364.     end)
  365.  
  366.     -- Name GUI and HP GUI (attach to current Head)
  367.     pcall(function()
  368.         local char = p.Character
  369.         local head = char and char:FindFirstChild("Head")
  370.         -- Name
  371.         if head and head.Parent then
  372.             local needNew = true
  373.             if obj.nameGui and obj.nameGui.Adornee == head and obj.nameGui.Parent == PlayerGui then needNew = false else if obj.nameGui then safeDestroy(obj.nameGui); obj.nameGui = nil; obj.nameLabel = nil end end
  374.             if needNew then
  375.                 local ok, bg = pcall(function()
  376.                     local bg = Instance.new("BillboardGui")
  377.                     bg.Name = "DeltaNameGui"
  378.                     bg.Adornee = head
  379.                     bg.Size = UDim2.new(0,90,0,14)
  380.                     bg.StudsOffset = Vector3.new(0,2.2,0)
  381.                     bg.AlwaysOnTop = true
  382.                     bg.Parent = PlayerGui
  383.                     local lbl = Instance.new("TextLabel", bg)
  384.                     lbl.Size = UDim2.new(1,0,1,0); lbl.BackgroundTransparency = 1
  385.                     lbl.Text = p.Name; lbl.Font = Enum.Font.SourceSans; lbl.TextSize = 12
  386.                     lbl.TextColor3 = Color3.new(1,1,1)
  387.                     return bg
  388.                 end)
  389.                 if ok and bg then obj.nameGui = bg; obj.nameLabel = bg:FindFirstChildWhichIsA("TextLabel") end
  390.             end
  391.         else
  392.             if obj.nameGui then safeDestroy(obj.nameGui); obj.nameGui = nil; obj.nameLabel = nil end
  393.         end
  394.  
  395.         -- HP
  396.         if head and head.Parent then
  397.             local needNew = true
  398.             if obj.hpGui and obj.hpGui.Adornee == head and obj.hpGui.Parent == PlayerGui then needNew = false else if obj.hpGui then safeDestroy(obj.hpGui); obj.hpGui = nil; obj.hpFill = nil end end
  399.             if needNew then
  400.                 local ok, hp = pcall(function()
  401.                     local hp = Instance.new("BillboardGui")
  402.                     hp.Name = "DeltaHPGui"
  403.                     hp.Adornee = head
  404.                     hp.Size = UDim2.new(0,8,0,18)
  405.                     hp.StudsOffset = Vector3.new(1.25,1.6,0)
  406.                     hp.AlwaysOnTop = true
  407.                     local bgf = Instance.new("Frame", hp)
  408.                     bgf.Size = UDim2.new(1,0,1,0); bgf.BackgroundColor3 = Color3.fromRGB(200,200,200)
  409.                     local fill = Instance.new("Frame", bgf); fill.Name="Fill"; fill.AnchorPoint = Vector2.new(0,1); fill.Position = UDim2.new(0,0,1,0); fill.Size = UDim2.new(1,0,1,0); fill.BackgroundColor3 = Color3.fromRGB(0,220,0)
  410.                     hp.Parent = PlayerGui
  411.                     return hp
  412.                 end)
  413.                 if ok and hp then obj.hpGui = hp; obj.hpFill = obj.hpGui:FindFirstChildWhichIsA("Frame") and obj.hpGui:FindFirstChildWhichIsA("Frame"):FindFirstChild("Fill") end
  414.             end
  415.         else
  416.             if obj.hpGui then safeDestroy(obj.hpGui); obj.hpGui = nil; obj.hpFill = nil end
  417.         end
  418.     end)
  419.  
  420.     -- Drawing line
  421.     if HAS_DRAWING then
  422.         pcall(function()
  423.             if not obj.line or (obj.line and (not pcall(function() return obj.line and obj.line.From end))) then
  424.                 if obj.line then removeDrawingLine(obj.line); obj.line = nil end
  425.                 local ok, line = pcall(function() return Drawing.new("Line") end)
  426.                 if ok and line then line.Thickness = 1.8; line.Visible = false; obj.line = line end
  427.             end
  428.         end)
  429.     else
  430.         if obj.line then removeDrawingLine(obj.line); obj.line = nil end
  431.     end
  432.  
  433.     -- died connection
  434.     pcall(function()
  435.         if obj.diedConn and obj.diedConn.Connected then return end
  436.         if obj.diedConn then pcall(function() obj.diedConn:Disconnect() end) end
  437.         local hum = p.Character and getHumanoid(p.Character)
  438.         if hum then
  439.             obj.diedConn = hum.Died:Connect(function()
  440.                 task.delay(1.5, function() clearESPForPlayer(p) end)
  441.             end)
  442.         end
  443.     end)
  444. end
  445.  
  446. local function updateESPForPlayer(p)
  447.     if not p then return end
  448.     if not Settings.ESP then clearESPForPlayer(p); return end
  449.     -- Try a few times to attach GUIs (non-blocking)
  450.     task.spawn(function()
  451.         local tries = 0
  452.         while tries < 8 do
  453.             tries = tries + 1
  454.             ensureESPObjectsForPlayer(p)
  455.             local obj = espCache[p]
  456.             if obj then
  457.                 pcall(function()
  458.                     if obj.highlight and obj.highlight.Parent then
  459.                         if p == currentPlayer then
  460.                             obj.highlight.FillColor = Color3.fromRGB(200,140,255)
  461.                             obj.highlight.FillTransparency = 0.08
  462.                             obj.highlight.Enabled = true
  463.                         else
  464.                             if p.Team and p.Team.Name == "Guards" then obj.highlight.FillColor = Color3.fromRGB(0,140,255)
  465.                             elseif p.Team and p.Team.Name == "Inmates" then obj.highlight.FillColor = Color3.fromRGB(255,140,0)
  466.                             else obj.highlight.FillColor = Color3.fromRGB(255,40,40) end
  467.                             obj.highlight.FillTransparency = 0.6
  468.                             obj.highlight.Enabled = true
  469.                         end
  470.                     end
  471.  
  472.                     if obj.nameGui and obj.nameLabel then
  473.                         if Settings.ESP_Name and p.Character and p.Character:FindFirstChild("Head") then
  474.                             if not obj.nameGui.Parent then obj.nameGui.Parent = PlayerGui end
  475.                             obj.nameLabel.Text = p.Name
  476.                             obj.nameLabel.TextColor3 = Color3.new(1,1,1)
  477.                         else
  478.                             if obj.nameGui and obj.nameGui.Parent then obj.nameGui.Parent = nil end
  479.                         end
  480.                     end
  481.  
  482.                     local hum = p.Character and getHumanoid(p.Character)
  483.                     if obj.hpGui and obj.hpFill then
  484.                         if Settings.ESP_Health and hum then
  485.                             local pct = math.clamp((hum.Health or 0)/(hum.MaxHealth or 100), 0, 1)
  486.                             obj.hpFill.Size = UDim2.new(1,0,pct,0)
  487.                             if not obj.hpGui.Parent then obj.hpGui.Parent = PlayerGui end
  488.                         else
  489.                             if obj.hpGui and obj.hpGui.Parent then obj.hpGui.Parent = nil end
  490.                         end
  491.                     end
  492.  
  493.                     if obj.line and HAS_DRAWING and Settings.ESP_Line and p.Character then
  494.                         local targetPart = getTargetPartFromChar(p.Character) or p.Character:FindFirstChild("HumanoidRootPart") or p.Character:FindFirstChild("Head")
  495.                         if targetPart then
  496.                             local v,on = Camera:WorldToViewportPoint(targetPart.Position)
  497.                             if on then
  498.                                 obj.line.Visible = true
  499.                                 obj.line.From = Camera.ViewportSize/2
  500.                                 obj.line.To = Vector2.new(v.X, v.Y)
  501.                                 if p == currentPlayer then obj.line.Color = Color3.fromRGB(200,140,255)
  502.                                 else
  503.                                     if p.Team and p.Team.Name == "Guards" then obj.line.Color = Color3.fromRGB(0,140,255)
  504.                                     elseif p.Team and p.Team.Name == "Inmates" then obj.line.Color = Color3.fromRGB(255,140,0)
  505.                                     else obj.line.Color = Color3.fromRGB(255,40,40) end
  506.                                 end
  507.                             else
  508.                                 obj.line.Visible = false
  509.                             end
  510.                         else
  511.                             obj.line.Visible = false
  512.                         end
  513.                     elseif obj.line then obj.line.Visible = false end
  514.                 end)
  515.             end
  516.  
  517.             -- break early if successfully attached to character head/highlight
  518.             local okAttached = false
  519.             local o = espCache[p]
  520.             if o then
  521.                 if (o.highlight and o.highlight.Parent == (p.Character or nil)) then okAttached = true end
  522.                 if (o.nameGui and o.nameGui.Adornee == (p.Character and p.Character:FindFirstChild("Head"))) then okAttached = true end
  523.                 if (o.hpGui and o.hpGui.Adornee == (p.Character and p.Character:FindFirstChild("Head"))) then okAttached = true end
  524.             end
  525.             if okAttached then break end
  526.             task.wait(0.08)
  527.         end
  528.     end)
  529. end
  530.  
  531. -- Hook up player events for ESP
  532. for _,p in ipairs(Players:GetPlayers()) do
  533.     p.CharacterAdded:Connect(function() task.delay(0.06, function() if Settings.ESP then updateESPForPlayer(p) end end) end)
  534.     p.CharacterRemoving:Connect(function() clearESPForPlayer(p) end)
  535. end
  536. Players.PlayerAdded:Connect(function(p) p.CharacterAdded:Connect(function() task.delay(0.06, function() if Settings.ESP then updateESPForPlayer(p) end end) end); p.CharacterRemoving:Connect(function() clearESPForPlayer(p) end) end)
  537. Players.PlayerRemoving:Connect(function(p) clearESPForPlayer(p) end)
  538.  
  539. -- ================= Miss probability helpers
  540. local function registerShot()
  541.     table.insert(recentShots, tick())
  542.     while #recentShots > 0 and recentShots[1] < tick() - (Settings.ErrarShotWindow or 1.2) do table.remove(recentShots,1) end
  543. end
  544.  
  545. local function updateCameraMovement(dt)
  546.     if not lastCameraCFrame then lastCameraCFrame = Camera.CFrame; return end
  547.     local a1 = lastCameraCFrame.LookVector
  548.     local a2 = Camera.CFrame.LookVector
  549.     local dot = math.clamp(a1:Dot(a2), -1, 1)
  550.     local ang = math.acos(dot)
  551.     local speed = ang / math.max(dt, 1/120)
  552.     camAngularSpeed = camAngularSpeed * 0.8 + speed * 0.2
  553.     lastCameraCFrame = Camera.CFrame
  554. end
  555.  
  556. local function getVelocityMagnitudeForPlayer(pl)
  557.     if not pl or not pl.Character then return 0 end
  558.     local hrp = pl.Character:FindFirstChild("HumanoidRootPart")
  559.     if not hrp then return 0 end
  560.     return hrp.Velocity and hrp.Velocity.Magnitude or 0
  561. end
  562.  
  563. local function computeMissProbability(targetPlayer)
  564.     if not targetPlayer then return 0 end
  565.     local base = Settings.ErrarBase or 0.26
  566.     local maxv = Settings.ErrarMax or 0.45
  567.     local jitter = Settings.ErrarJitter or 0.07
  568.  
  569.     local myRoot = LP.Character and LP.Character:FindFirstChild("HumanoidRootPart")
  570.     local distNorm = 0
  571.     if myRoot and targetPlayer.Character and targetPlayer.Character:FindFirstChild("HumanoidRootPart") then
  572.         local d = (targetPlayer.Character.HumanoidRootPart.Position - myRoot.Position).Magnitude
  573.         distNorm = math.clamp(d / (SilentAimSettings.MaxDistance or 600), 0, 1)
  574.     end
  575.  
  576.     local targetVel = getVelocityMagnitudeForPlayer(targetPlayer) / 20
  577.     local localVel = getVelocityMagnitudeForPlayer(LP) / 20
  578.     targetVel = math.clamp(targetVel, 0, 1)
  579.     localVel = math.clamp(localVel, 0, 1)
  580.     local cam = math.clamp(camAngularSpeed / 2.5, 0, 1)
  581.     local streak = math.clamp(#recentShots / 8, 0, 1)
  582.  
  583.     local p = base
  584.     p = p + distNorm * (Settings.ErrarDistWeight or 0.12)
  585.     p = p + targetVel * (Settings.ErrarTargetMoveWeight or 0.18)
  586.     p = p + localVel * (Settings.ErrarLocalMoveWeight or 0.12)
  587.     p = p + cam * (Settings.ErrarCamMoveWeight or 0.12)
  588.     p = p + streak * (Settings.ErrarShotStreakWeight or 0.05)
  589.  
  590.     local j = ((math.random()-0.5) * 2) * jitter
  591.     p = p + j
  592.  
  593.     local last = perTargetProb[targetPlayer] or p
  594.     local smooth = last * 0.7 + p * 0.3
  595.     perTargetProb[targetPlayer] = smooth
  596.  
  597.     return math.clamp(smooth, 0.01, maxv)
  598. end
  599.  
  600. -- ================= NAMECALL HOOK (kept)
  601. local namecall_old = nil
  602. if CAN_HOOK then
  603.     local ok, mt = pcall(function() return getrawmetatable(game) end)
  604.     if ok and mt then
  605.         pcall(function() setreadonly(mt,false) end)
  606.         namecall_old = mt.__namecall
  607.         mt.__namecall = newcclosure(function(self,...)
  608.             local args={...}
  609.             local method = getnamecallmethod and getnamecallmethod() or ""
  610.  
  611.             if method == "Raycast" or method == "FireServer" or method == "InvokeServer" then
  612.                 recentShots[#recentShots+1] = tick()
  613.             end
  614.  
  615.             if Settings.SilentAim and currentTargetPart and currentPlayer then
  616.                 if Settings.DelayFarTargets then
  617.                     local deadline = targetDeadline[currentPlayer] or (targetEnterTime[currentPlayer] or 0) + (Settings.DelayMean or 0.35)
  618.                     if tick() < deadline then return namecall_old(self, ...) end
  619.                 end
  620.  
  621.                 local shouldRedirect = false
  622.                 local offset = Vector3.new()
  623.                 local hitChance = (Settings.TargetPart == "Random") and 0.95 or 0.78
  624.                 if math.random() <= hitChance then shouldRedirect = true end
  625.  
  626.                 if Settings.ErrarTiros and cachedMissTarget and cachedMissTarget == currentPlayer then
  627.                     if math.random() < (cachedMissProb or 0) then
  628.                         shouldRedirect = true
  629.                         local st = deviationState[currentPlayer] or { idx = 0, side = (math.random()<0.5 and -1 or 1), lastFlip = tick() }
  630.                         st.idx = (st.idx or 0) + 1
  631.                         if tick() - (st.lastFlip or 0) > (0.12 + math.random()*0.28) then st.side = -st.side; st.lastFlip = tick() end
  632.                         deviationState[currentPlayer] = st
  633.                         offset = computeLateralOffset(currentTargetPart.Position, st.side)
  634.                     end
  635.                 end
  636.  
  637.                 if method == "Raycast" then
  638.                     local origin = args[1] or Camera.CFrame.Position
  639.                     local originPos = origin
  640.                     if typeof(origin) == "CFrame" then originPos = origin.Position end
  641.                     if typeof(originPos) == "Vector3" and shouldRedirect and currentTargetPart then
  642.                         args[2] = (currentTargetPart.Position + offset) - originPos
  643.                     end
  644.                     return namecall_old(self, unpack(args))
  645.                 end
  646.  
  647.                 if (method == "FireServer" or method == "InvokeServer") then
  648.                     local remoteName = (typeof(self) == "Instance" and self.Name) or ""
  649.                     local n = string.lower(remoteName)
  650.                     local blacklist = {"arrest","cuff","handcuff","detain","taser","stun","punch","melee"}
  651.                     for _,sub in ipairs(blacklist) do if string.find(n, sub) then return namecall_old(self, ...) end end
  652.  
  653.                     if shouldRedirect and currentTargetPart then
  654.                         for i=1,#args do
  655.                             local a = args[i]
  656.                             if typeof(a) == "Vector3" then args[i] = currentTargetPart.Position + offset
  657.                             elseif typeof(a) == "CFrame" then args[i] = CFrame.new(currentTargetPart.Position + offset)
  658.                             elseif type(a) == "table" and a.Position then args[i] = { Position = currentTargetPart.Position + offset } end
  659.                         end
  660.                     end
  661.                     return namecall_old(self, unpack(args))
  662.                 end
  663.             end
  664.  
  665.             return namecall_old(self, ...)
  666.         end)
  667.         pcall(function() setreadonly(mt,true) end)
  668.     end
  669. end
  670.  
  671. -- ================= SAFE TELEPORT HELPERS
  672. local function reattachCamera()
  673.     pcall(function()
  674.         local hum = LP.Character and LP.Character:FindFirstChildOfClass("Humanoid")
  675.         if hum then Camera.CameraSubject = hum; Camera.CameraType = Enum.CameraType.Custom end
  676.     end)
  677. end
  678.  
  679. local TELEPORT_THROTTLE = 0.6
  680. local _lastTeleport = 0
  681. local function isSafeGroundAt(cframe)
  682.     local origin = cframe.Position + Vector3.new(0, 30, 0)
  683.     local params = RaycastParams.new()
  684.     params.FilterType = Enum.RaycastFilterType.Blacklist
  685.     params.FilterDescendantsInstances = {LP.Character}
  686.     local r = Workspace:Raycast(origin, Vector3.new(0,-60,0), params)
  687.     return r
  688. end
  689.  
  690. local function safeTeleportTo(cframeTarget)
  691.     if not LP.Character or not LP.Character:FindFirstChild("HumanoidRootPart") then return false end
  692.     if tick() - _lastTeleport < TELEPORT_THROTTLE then return false end
  693.     _lastTeleport = tick()
  694.     local hrp = LP.Character.HumanoidRootPart
  695.     local finalCFrame = cframeTarget
  696.     for i=1,6 do
  697.         local ok = isSafeGroundAt(finalCFrame)
  698.         if ok then break end
  699.         finalCFrame = finalCFrame + Vector3.new(0,1.2,0)
  700.         task.wait(0.01)
  701.     end
  702.     local ok, err = pcall(function()
  703.         hrp.CFrame = finalCFrame
  704.         task.wait(0.03)
  705.         pcall(reattachCamera)
  706.     end)
  707.     if not ok then warn("safeTeleportTo failed:", err); return false end
  708.     return true
  709. end
  710.  
  711. -- ================= WEAPON PICK helpers (TREMER até pegar)
  712. local function hasToolNamed(name)
  713.     local lname = tostring(name):lower()
  714.     if LP.Character then for _,c in ipairs(LP.Character:GetChildren()) do if c:IsA("Tool") and string.find((c.Name or ""):lower(), lname,1,true) then return true end end end
  715.     local bp = LP:FindFirstChildOfClass("Backpack")
  716.     if bp then for _,c in ipairs(bp:GetChildren()) do if c:IsA("Tool") and string.find((c.Name or ""):lower(), lname,1,true) then return true end end end
  717.     return false
  718. end
  719.  
  720. local function waitForPickup(weaponName, timeout)
  721.     local deadline = tick() + (timeout or 4)
  722.     if hasToolNamed(weaponName) then return true end
  723.     local picked=false; local conns={}
  724.     if LP.Character then table.insert(conns, LP.Character.ChildAdded:Connect(function(child) if child and child:IsA("Tool") and string.find((child.Name or ""):lower(), weaponName:lower(),1,true) then picked=true end end)) end
  725.     local bp = LP:FindFirstChildOfClass("Backpack")
  726.     if bp then table.insert(conns, bp.ChildAdded:Connect(function(child) if child and child:IsA("Tool") and string.find((child.Name or ""):lower(), weaponName:lower(),1,true) then picked=true end end)) end
  727.     while not picked and tick() < deadline do
  728.         if hasToolNamed(weaponName) then picked=true; break end
  729.         task.wait(0.08)
  730.     end
  731.     for _,c in ipairs(conns) do pcall(function() c:Disconnect() end) end
  732.     return picked
  733. end
  734.  
  735. local function instantTeleportPick(list)
  736.     if not LP.Character or not LP.Character:FindFirstChild("HumanoidRootPart") then return end
  737.     local hrp = LP.Character.HumanoidRootPart
  738.     local origin = hrp.CFrame
  739.     local autoWas = Settings.AutoPickWeapons
  740.     Settings.AutoPickWeapons = false
  741.  
  742.     for _,w in ipairs(list) do
  743.         if not hasToolNamed(w) then
  744.             local cf = TELEPORT_CFRAMES[w]
  745.             if cf then
  746.                 safeTeleportTo(cf)
  747.                 local deadline = tick() + 2.0
  748.                 while tick() < deadline and not hasToolNamed(w) do
  749.                     local shakeX = (math.random() - 0.5) * 0.12
  750.                     local shakeZ = (math.random() - 0.5) * 0.12
  751.                     local shakeY = (math.random() - 0.5) * 0.02
  752.                     pcall(function()
  753.                         if hrp and hrp.Parent then hrp.CFrame = cf * CFrame.new(shakeX, shakeY, shakeZ) end
  754.                     end)
  755.                     task.wait(0.06)
  756.                 end
  757.                 if not hasToolNamed(w) then
  758.                     pcall(function()
  759.                         if hrp and hrp.Parent then
  760.                             local forward = cf.LookVector * 0.6
  761.                             hrp.CFrame = CFrame.new(cf.Position + forward, cf.Position + forward + cf.LookVector)
  762.                         end
  763.                     end)
  764.                     task.wait(0.25)
  765.                 end
  766.                 if not hasToolNamed(w) then
  767.                     local picked = waitForPickup(w, 0.9)
  768.                     if not picked then end
  769.                 end
  770.             end
  771.             task.wait(0.06)
  772.         end
  773.     end
  774.  
  775.     pcall(function()
  776.         if LP.Character and LP.Character:FindFirstChild("HumanoidRootPart") then LP.Character.HumanoidRootPart.CFrame = origin end
  777.     end)
  778.     task.delay(0.05, reattachCamera)
  779.     Settings.AutoPickWeapons = autoWas
  780. end
  781.  
  782. -- Auto-pick worker
  783. task.spawn(function()
  784.     while true do
  785.         if Settings.AutoPickWeapons then
  786.             local sel = {}
  787.             for name,ok in pairs(Settings.Mods_Weapons) do if ok then table.insert(sel, name) end end
  788.             if #sel > 0 and LP.Character and LP.Character:FindFirstChild("HumanoidRootPart") then
  789.                 instantTeleportPick(sel)
  790.                 task.wait(1.2)
  791.             else
  792.                 task.wait(0.9)
  793.             end
  794.         else task.wait(0.9) end
  795.     end
  796. end)
  797.  
  798. -- ================= UI (menu) ===========================================
  799. pcall(function() local old = PlayerGui:FindFirstChild("delta_final_ui"); if old then old:Destroy() end end)
  800. local gui = Instance.new("ScreenGui")
  801. gui.Name = "delta_final_ui"
  802. gui.ResetOnSpawn = false
  803. gui.Parent = PlayerGui
  804. gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  805. gui.Enabled = true
  806.  
  807. local openBtn = Instance.new("TextButton", gui)
  808. openBtn.Size = UDim2.new(0,26,0,26)
  809. openBtn.Position = UDim2.new(0,8,0.5,-13)
  810. openBtn.Text = "≡"
  811. openBtn.TextSize = 18
  812. openBtn.BackgroundColor3 = Color3.fromRGB(28,28,28)
  813. openBtn.TextColor3 = Color3.new(1,1,1)
  814. Instance.new("UICorner", openBtn)
  815.  
  816. local menu = Instance.new("Frame", gui)
  817. menu.Size = UDim2.new(0,320,0,420)
  818. menu.Position = UDim2.new(0.5,-160,0.5,-210)
  819. menu.BackgroundColor3 = Color3.fromRGB(34,34,34)
  820. menu.Visible = false
  821. Instance.new("UICorner", menu)
  822.  
  823. local header = Instance.new("Frame", menu); header.Size = UDim2.new(1,0,0,36); header.BackgroundTransparency = 1
  824. local title = Instance.new("TextLabel", header); title.Size = UDim2.new(1,-60,1,0); title.Position = UDim2.new(0,10,0,0); title.BackgroundTransparency = 1; title.Text="Delta Mobile — FINAL"; title.TextColor3 = Color3.new(1,1,1); title.Font=Enum.Font.SourceSansBold; title.TextSize=16; title.TextXAlignment = Enum.TextXAlignment.Left
  825. local closeBtn = Instance.new("TextButton", header); closeBtn.Size = UDim2.new(0,18,0,18); closeBtn.Position = UDim2.new(1,-40,0,8); closeBtn.Text="✕"; closeBtn.BackgroundColor3 = Color3.fromRGB(45,45,45); closeBtn.TextColor3 = Color3.new(1,1,1); Instance.new("UICorner", closeBtn)
  826.  
  827. local content = Instance.new("Frame", menu); content.Position = UDim2.new(0,8,0,42); content.Size = UDim2.new(1,-16,1,-58); content.BackgroundTransparency = 1
  828.  
  829. local function makeTab(name, pos)
  830.     local b = Instance.new("TextButton", content)
  831.     b.Size = UDim2.new(0.24,-6,0,26)
  832.     b.Position = UDim2.new(pos,0,0,4)
  833.     b.Text = name
  834.     b.BackgroundColor3 = Color3.fromRGB(45,45,45)
  835.     b.TextColor3 = Color3.new(1,1,1)
  836.     b.TextSize = 13
  837.     Instance.new("UICorner", b)
  838.     return b
  839. end
  840.  
  841. local tabAim = makeTab("Aim", 0.01)
  842. local tabESP = makeTab("ESP", 0.26)
  843. local tabMods = makeTab("Mods", 0.51)
  844. local tabConfig = makeTab("Config", 0.76)
  845.  
  846. local function makeScrollPanel()
  847.     local s = Instance.new("ScrollingFrame", content)
  848.     s.Size = UDim2.new(1,0,1,-40)
  849.     s.Position = UDim2.new(0,0,0,40)
  850.     s.BackgroundTransparency = 1
  851.     s.ScrollBarThickness = 8
  852.     s.AutomaticCanvasSize = Enum.AutomaticSize.Y
  853.     local layout = Instance.new("UIListLayout", s)
  854.     layout.SortOrder = Enum.SortOrder.LayoutOrder
  855.     layout.Padding = UDim.new(0,8)
  856.     return s
  857. end
  858.  
  859. local aimPanel = makeScrollPanel()
  860. local espPanel = makeScrollPanel()
  861. local modsPanel = makeScrollPanel()
  862. local configPanel = makeScrollPanel()
  863. aimPanel.Visible = true; espPanel.Visible = false; modsPanel.Visible = false; configPanel.Visible = false
  864.  
  865. local function showPanel(p) aimPanel.Visible=false; espPanel.Visible=false; modsPanel.Visible=false; configPanel.Visible=false; p.Visible = true; p:BringToFront() end
  866. tabAim.MouseButton1Click:Connect(function() showPanel(aimPanel) end)
  867. tabESP.MouseButton1Click:Connect(function() showPanel(espPanel) end)
  868. tabMods.MouseButton1Click:Connect(function() showPanel(modsPanel) end)
  869. tabConfig.MouseButton1Click:Connect(function() showPanel(configPanel) end)
  870. openBtn.MouseButton1Click:Connect(function() menu.Visible = not menu.Visible end)
  871. closeBtn.MouseButton1Click:Connect(function() menu.Visible = false end)
  872.  
  873. local function createToggle(parent, label, key)
  874.     local b = Instance.new("TextButton", parent)
  875.     b.Size = UDim2.new(0.96,0,0,30)
  876.     b.BackgroundColor3 = Color3.fromRGB(45,45,45)
  877.     b.TextColor3 = Color3.new(1,1,1)
  878.     b.Text = label.." : "..(Settings[key] and "ON" or "OFF")
  879.     b.TextXAlignment = Enum.TextXAlignment.Left
  880.     b.Font = Enum.Font.SourceSans
  881.     b.TextSize = 13
  882.     Instance.new("UICorner", b)
  883.     b.MouseButton1Click:Connect(function()
  884.         Settings[key] = not Settings[key]
  885.         b.Text = label.." : "..(Settings[key] and "ON" or "OFF")
  886.         if key == "ShowFOV" then
  887.             if fovCircle then fovCircle.Visible = Settings.ShowFOV end
  888.             if fovGui then fovGui.Visible = Settings.ShowFOV end
  889.         elseif key == "ESP" then
  890.             if Settings.ESP then
  891.                 for _,pl in ipairs(Players:GetPlayers()) do task.spawn(function() updateESPForPlayer(pl) end) end
  892.             else
  893.                 for _,pl in ipairs(Players:GetPlayers()) do clearESPForPlayer(pl) end
  894.             end
  895.         end
  896.     end)
  897.     return b
  898. end
  899.  
  900. local function addCollapsible(parent, titleText, contentHeight, defaultOpen)
  901.     local hdr = Instance.new("TextButton", parent)
  902.     hdr.Size = UDim2.new(0.96,0,0,28)
  903.     hdr.BackgroundColor3 = Color3.fromRGB(55,55,55)
  904.     hdr.Text = (defaultOpen and "▼ " or "► ") .. titleText
  905.     hdr.TextColor3 = Color3.new(1,1,1)
  906.     hdr.TextXAlignment = Enum.TextXAlignment.Left
  907.     Instance.new("UICorner", hdr)
  908.     local container = Instance.new("Frame", parent)
  909.     container.Size = UDim2.new(0.96,0,0, (defaultOpen and contentHeight or 0))
  910.     container.Position = UDim2.new(0,0,0,30)
  911.     container.BackgroundColor3 = Color3.fromRGB(40,40,40)
  912.     container.ClipsDescendants = true
  913.     Instance.new("UICorner", container)
  914.     hdr.MouseButton1Click:Connect(function()
  915.         local open = container.Size.Y.Offset > 0
  916.         if open then hdr.Text = "► " .. titleText; TweenService:Create(container, TweenInfo.new(0.18, Enum.EasingStyle.Quad), {Size = UDim2.new(0.96,0,0,0)}):Play()
  917.         else hdr.Text = "▼ " .. titleText; TweenService:Create(container, TweenInfo.new(0.18, Enum.EasingStyle.Quad), {Size = UDim2.new(0.96,0,0,contentHeight)}):Play() end
  918.     end)
  919.     return hdr, container
  920. end
  921.  
  922. -- Build Aim panel
  923. do
  924.     createToggle(aimPanel, "Silent Aim", "SilentAim")
  925.     createToggle(aimPanel, "Errar Tiros (lateral)", "ErrarTiros")
  926.     createToggle(aimPanel, "Delay p/ alvos (humanizado)", "DelayFarTargets")
  927.  
  928.     local tfHdr, tfCont = addCollapsible(aimPanel, "Team Filter (abrir/fechar)", 120, false)
  929.     local tfLabel = Instance.new("TextLabel", tfCont); tfLabel.Size = UDim2.new(1,0,0,18); tfLabel.BackgroundTransparency = 1; tfLabel.Text = "Marque equipes para incluir"; tfLabel.TextColor3 = Color3.new(1,1,1)
  930.     for i,tm in ipairs({"Guards","Inmates","Criminals"}) do
  931.         local b = Instance.new("TextButton", tfCont)
  932.         b.Size = UDim2.new(0.96,0,0,28)
  933.         b.Position = UDim2.new(0,0,0,22 + (i-1)*30)
  934.         b.Text = (Settings.TeamFilter[tm] and "☑ " or "☐ ")..tm
  935.         b.BackgroundColor3 = Color3.fromRGB(45,45,45)
  936.         b.TextColor3 = Color3.new(1,1,1)
  937.         Instance.new("UICorner", b)
  938.         b.MouseButton1Click:Connect(function()
  939.             Settings.TeamFilter[tm] = not Settings.TeamFilter[tm]
  940.             b.Text = (Settings.TeamFilter[tm] and "☑ " or "☐ ")..tm
  941.             Settings.TeamFilterEnabled = (Settings.TeamFilter.Guards or Settings.TeamFilter.Inmates or Settings.TeamFilter.Criminals)
  942.         end)
  943.     end
  944.  
  945.     createToggle(aimPanel, "Show FOV", "ShowFOV")
  946.     local fovRow = Instance.new("Frame", aimPanel); fovRow.Size = UDim2.new(0.96,0,0,50); fovRow.BackgroundTransparency = 1
  947.     local fovLabel = Instance.new("TextLabel", fovRow); fovLabel.Size = UDim2.new(1,0,0,18); fovLabel.BackgroundTransparency = 1; fovLabel.Text = "FOV: "..Settings.FOVRadius; fovLabel.TextColor3 = Color3.new(1,1,1)
  948.     local fovBar = Instance.new("Frame", fovRow); fovBar.Size = UDim2.new(1,0,0,12); fovBar.Position = UDim2.new(0,0,0,22); fovBar.BackgroundColor3 = Color3.fromRGB(45,45,45); Instance.new("UICorner", fovBar)
  949.     local fovFill = Instance.new("Frame", fovBar); fovFill.Size = UDim2.new(Settings.FOVRadius/500,0,1,0); fovFill.BackgroundColor3 = Color3.fromRGB(255,255,255); Instance.new("UICorner", fovFill)
  950.     local dragFOV=false
  951.     fovBar.InputBegan:Connect(function(i) if i.UserInputType==Enum.UserInputType.MouseButton1 or i.UserInputType==Enum.UserInputType.Touch then dragFOV=true end end)
  952.     fovBar.InputEnded:Connect(function(i) if i.UserInputType==Enum.UserInputType.MouseButton1 or i.UserInputType==Enum.UserInputType.Touch then dragFOV=false end end)
  953.     UserInputService.InputChanged:Connect(function(i)
  954.         if dragFOV and (i.UserInputType==Enum.UserInputType.MouseMovement or i.UserInputType==Enum.UserInputType.Touch) then
  955.             local left = fovBar.AbsolutePosition.X; local abs = fovBar.AbsoluteSize.X
  956.             local x = math.clamp(i.Position.X - left, 0, abs); local ratio = x/abs
  957.             Settings.FOVRadius = math.floor(10 + ratio * 490)
  958.             fovFill.Size = UDim2.new(Settings.FOVRadius/500,0,1,0)
  959.             fovLabel.Text = "FOV: "..Settings.FOVRadius
  960.             if fovCircle then fovCircle.Radius = Settings.FOVRadius end
  961.             if fovGui then fovGui.Size = UDim2.new(0, Settings.FOVRadius*2, 0, Settings.FOVRadius*2); fovGui.Position = UDim2.new(0.5, -Settings.FOVRadius, 0.5, -Settings.FOVRadius) end
  962.         end
  963.     end)
  964.  
  965.     local partLabel = Instance.new("TextLabel", aimPanel); partLabel.Size = UDim2.new(0.96,0,0,18); partLabel.BackgroundTransparency = 1; partLabel.Text="Target Part: "..Settings.TargetPart; partLabel.TextColor3 = Color3.new(1,1,1)
  966.     local partRow = Instance.new("Frame", aimPanel); partRow.Size = UDim2.new(0.96,0,0,34)
  967.     local btnH = Instance.new("TextButton", partRow); btnH.Size = UDim2.new(0.30,0,1,0); btnH.Text="Head"; btnH.BackgroundColor3 = Color3.fromRGB(45,45,45); btnH.TextColor3=Color3.new(1,1,1)
  968.     local btnT = Instance.new("TextButton", partRow); btnT.Size = UDim2.new(0.30,0,1,0); btnT.Position = UDim2.new(0.34,0,0,0); btnT.Text="Torso"; btnT.BackgroundColor3=Color3.fromRGB(45,45,45); btnT.TextColor3=Color3.new(1,1,1)
  969.     local btnR = Instance.new("TextButton", partRow); btnR.Size = UDim2.new(0.30,0,1,0); btnR.Position = UDim2.new(0.66,0,0,0); btnR.Text="Random"; btnR.BackgroundColor3=Color3.fromRGB(45,45,45); btnR.TextColor3=Color3.new(1,1,1)
  970.     btnH.MouseButton1Click:Connect(function() Settings.TargetPart="Head"; partLabel.Text="Target Part: Head" end)
  971.     btnT.MouseButton1Click:Connect(function() Settings.TargetPart="Torso"; partLabel.Text="Target Part: Torso" end)
  972.     btnR.MouseButton1Click:Connect(function() Settings.TargetPart="Random"; partLabel.Text="Target Part: Random" end)
  973. end
  974.  
  975. -- ESP panel
  976. do
  977.     createToggle(espPanel, "ESP Master", "ESP")
  978.     createToggle(espPanel, "ESP Nome", "ESP_Name")
  979.     createToggle(espPanel, "ESP Vida", "ESP_Health")
  980.     createToggle(espPanel, "ESP Linha", "ESP_Line")
  981. end
  982.  
  983. -- Mods panel (teleports, picks)
  984. do
  985.     local tpHdr, tpCont = addCollapsible(modsPanel, "Teleports (abrir/fechar)", 120, false)
  986.     local tpNames = {"Criminal Base","Telhado","Cafeteria"}
  987.     local tpButtons = {}
  988.     local selectedTp = nil
  989.     for i,name in ipairs(tpNames) do
  990.         local b = Instance.new("TextButton", tpCont)
  991.         b.Size = UDim2.new(0.94,0,0,26); b.Position = UDim2.new(0.03,0,0,(i-1)*30 + 6)
  992.         b.Text = name; b.BackgroundColor3 = Color3.fromRGB(60,60,60); b.TextColor3 = Color3.new(1,1,1)
  993.         Instance.new("UICorner", b)
  994.         b.MouseButton1Click:Connect(function()
  995.             selectedTp = name
  996.             for k,v in pairs(tpButtons) do if v then v.BackgroundColor3 = (k==name and Color3.fromRGB(120,160,240) or Color3.fromRGB(60,60,60)) end end
  997.         end)
  998.         tpButtons[name] = b
  999.     end
  1000.  
  1001.     local tpBtn = Instance.new("TextButton", modsPanel)
  1002.     tpBtn.Size = UDim2.new(0.96,0,0,30)
  1003.     tpBtn.Text = "Teleportar para local selecionado"
  1004.     tpBtn.BackgroundColor3 = Color3.fromRGB(45,45,45)
  1005.     tpBtn.TextColor3 = Color3.new(1,1,1)
  1006.     Instance.new("UICorner", tpBtn)
  1007.     tpBtn.MouseButton1Click:Connect(function()
  1008.         if not selectedTp then return end
  1009.         local cf = LOCATION_CFRAMES[selectedTp]
  1010.         if not cf then return end
  1011.         task.spawn(function() safeTeleportTo(cf) end)
  1012.     end)
  1013.  
  1014.     local weaponsHdr, weaponsCont = addCollapsible(modsPanel, "Armas (abrir/fechar)", 160, false)
  1015.     local order = {"MP5","REMINGTON","M4A1","FAL","AK-47"}
  1016.     for i,name in ipairs(order) do
  1017.         local b = Instance.new("TextButton", weaponsCont)
  1018.         b.Size = UDim2.new(0.94,0,0,28)
  1019.         b.Position = UDim2.new(0.03,0,0,(i-1)*32 + 6)
  1020.         b.Text = (Settings.Mods_Weapons[name] and "☑ " or "☐ ")..name
  1021.         b.BackgroundColor3 = Color3.fromRGB(45,45,45)
  1022.         b.TextColor3 = Color3.new(1,1,1)
  1023.         Instance.new("UICorner", b)
  1024.         b.MouseButton1Click:Connect(function()
  1025.             Settings.Mods_Weapons[name] = not Settings.Mods_Weapons[name]
  1026.             b.Text = (Settings.Mods_Weapons[name] and "☑ " or "☐ ")..name
  1027.         end)
  1028.     end
  1029.  
  1030.     local pickBtn = Instance.new("TextButton", modsPanel)
  1031.     pickBtn.Size = UDim2.new(0.96,0,0,30)
  1032.     pickBtn.Text = "Pegar Armas (Manual - Teleport)"
  1033.     pickBtn.BackgroundColor3 = Color3.fromRGB(45,45,45)
  1034.     pickBtn.TextColor3 = Color3.new(1,1,1)
  1035.     Instance.new("UICorner", pickBtn)
  1036.     pickBtn.MouseButton1Click:Connect(function()
  1037.         task.spawn(function()
  1038.             local sel = {}
  1039.             for name,ok in pairs(Settings.Mods_Weapons) do if ok then table.insert(sel, name) end end
  1040.             if #sel == 0 then return end
  1041.             instantTeleportPick(sel)
  1042.         end)
  1043.     end)
  1044.  
  1045.     local autoBtn = Instance.new("TextButton", modsPanel)
  1046.     autoBtn.Size = UDim2.new(0.22,0,0,22)
  1047.     autoBtn.Text = "Auto"
  1048.     autoBtn.BackgroundColor3 = Color3.fromRGB(45,45,45)
  1049.     autoBtn.TextColor3 = Color3.new(1,1,1)
  1050.     Instance.new("UICorner", autoBtn)
  1051.     autoBtn.MouseButton1Click:Connect(function() Settings.AutoPickWeapons = not Settings.AutoPickWeapons; autoBtn.BackgroundColor3 = Settings.AutoPickWeapons and Color3.fromRGB(120,160,240) or Color3.fromRGB(45,45,45) end)
  1052. end
  1053.  
  1054. -- Config panel (kept simple)
  1055. do
  1056.     local rejoinBtn = Instance.new("TextButton", configPanel)
  1057.     rejoinBtn.Size = UDim2.new(0.96,0,0,30)
  1058.     rejoinBtn.Position = UDim2.new(0.02,0,0,8)
  1059.     rejoinBtn.Text = "Rejoin (mesmo place)"
  1060.     rejoinBtn.BackgroundColor3 = Color3.fromRGB(45,45,45)
  1061.     rejoinBtn.TextColor3 = Color3.new(1,1,1)
  1062.     Instance.new("UICorner", rejoinBtn)
  1063.     rejoinBtn.MouseButton1Click:Connect(function() pcall(function() TeleportService:Teleport(game.PlaceId, LP) end) end)
  1064.  
  1065.     local optBtn = Instance.new("TextButton", configPanel)
  1066.     optBtn.Size = UDim2.new(0.96,0,0,30)
  1067.     optBtn.Position = UDim2.new(0.02,0,0,48)
  1068.     optBtn.Text = "Otimização : "..(Settings.Optimization and "ON" or "OFF")
  1069.     optBtn.BackgroundColor3 = Color3.fromRGB(45,45,45)
  1070.     optBtn.TextColor3 = Color3.new(1,1,1)
  1071.     Instance.new("UICorner", optBtn)
  1072.     optBtn.MouseButton1Click:Connect(function()
  1073.         Settings.Optimization = not Settings.Optimization
  1074.         optBtn.Text = "Otimização : "..(Settings.Optimization and "ON" or "OFF")
  1075.         pcall(function() applyOptimization(Settings.Optimization) end)
  1076.     end)
  1077.  
  1078.     -- Saved configs simplified (kept reading/writing minimal)
  1079.     local CONFIG_FILENAME = "delta_mobile_configs.json"
  1080.     local AUTOLOAD_FILENAME = "delta_mobile_autoload.json"
  1081.     local savedConfigs = {}
  1082.     if HAS_FILE then
  1083.         pcall(function()
  1084.             if isfile(CONFIG_FILENAME) then
  1085.                 local raw = readfile(CONFIG_FILENAME)
  1086.                 local ok, t = pcall(function() return HttpService:JSONDecode(raw) end)
  1087.                 if ok and type(t)=="table" then savedConfigs = t end
  1088.             end
  1089.         end)
  1090.     end
  1091.  
  1092.     local cfgHdr, cfgCont = addCollapsible(configPanel, "Configs salvas (abrir/fechar)", 160, false)
  1093.     local listBox = Instance.new("ScrollingFrame", cfgCont); listBox.Size = UDim2.new(1,0,1,0); listBox.BackgroundTransparency = 1; listBox.AutomaticCanvasSize = Enum.AutomaticSize.Y; listBox.ScrollBarThickness = 8
  1094.     local layout = Instance.new("UIListLayout", listBox); layout.Padding = UDim.new(0,6)
  1095.     local selectedCfg = nil
  1096.     local btnMap = {}
  1097.     local function applyConfig(conf)
  1098.         if not conf then return end
  1099.         for k,v in pairs(conf.Settings or {}) do Settings[k] = v end
  1100.         for k,v in pairs(conf.Mods_Weapons or {}) do Settings.Mods_Weapons[k] = v end
  1101.         for k,v in pairs(conf.TeamFilter or {}) do Settings.TeamFilter[k] = v end
  1102.     end
  1103.     local function rebuildCfgList()
  1104.         for _,c in ipairs(listBox:GetChildren()) do if c:IsA("TextButton") then c:Destroy() end end
  1105.         local names = {}
  1106.         for n,_ in pairs(savedConfigs) do table.insert(names,n) end
  1107.         table.sort(names)
  1108.         for i,n in ipairs(names) do
  1109.             local b = Instance.new("TextButton", listBox)
  1110.             b.Size = UDim2.new(0.94,0,0,26)
  1111.             b.Position = UDim2.new(0.03,0,0,(i-1)*30 + 6)
  1112.             b.Text = n
  1113.             b.BackgroundColor3 = Color3.fromRGB(60,60,60)
  1114.             b.TextColor3 = Color3.new(1,1,1)
  1115.             b.TextXAlignment = Enum.TextXAlignment.Left
  1116.             Instance.new("UICorner", b)
  1117.             b.MouseButton1Click:Connect(function()
  1118.                 selectedCfg = n
  1119.                 for k,v in pairs(btnMap) do if v then v.BackgroundColor3 = (k==n and Color3.fromRGB(120,160,240) or Color3.fromRGB(60,60,60)) end end
  1120.                 if Settings.AutoLoadConfigs then applyConfig(savedConfigs[n]) end
  1121.             end)
  1122.             btnMap[n] = b
  1123.         end
  1124.     end
  1125.     rebuildCfgList()
  1126.  
  1127.     local saveBox = Instance.new("TextBox", configPanel); saveBox.Size = UDim2.new(0.96,0,0,28); saveBox.Position = UDim2.new(0.02,0,0, 8 + 36 + 8); saveBox.BackgroundColor3 = Color3.fromRGB(50,50,50); saveBox.TextColor3 = Color3.new(1,1,1)
  1128.     local saveBtn = Instance.new("TextButton", configPanel); saveBtn.Size = UDim2.new(0.46,0,0,30); saveBtn.Position = UDim2.new(0.02,0,0, 8 +36 + 44); saveBtn.Text="Salvar"; saveBtn.BackgroundColor3 = Color3.fromRGB(60,60,60); saveBtn.TextColor3 = Color3.new(1,1,1); Instance.new("UICorner", saveBtn)
  1129.     local loadBtn = Instance.new("TextButton", configPanel); loadBtn.Size = UDim2.new(0.46,0,0,30); loadBtn.Position = UDim2.new(0.50,0,0, 8 +36 + 44); loadBtn.Text="Carregar"; loadBtn.BackgroundColor3 = Color3.fromRGB(60,60,60); loadBtn.TextColor3 = Color3.new(1,1,1); Instance.new("UICorner", loadBtn)
  1130.     local delBtn = Instance.new("TextButton", configPanel); delBtn.Size = UDim2.new(0.96,0,0,30); delBtn.Position = UDim2.new(0.02,0,0, 8 +36 + 84); delBtn.Text="Apagar selecionado"; delBtn.BackgroundColor3 = Color3.fromRGB(60,60,60); delBtn.TextColor3 = Color3.new(1,1,1); Instance.new("UICorner", delBtn)
  1131.  
  1132.     saveBtn.MouseButton1Click:Connect(function()
  1133.         if not HAS_FILE then return end
  1134.         local name = tostring(saveBox.Text or ""):gsub("^%s*(.-)%s*$","%1")
  1135.         if name == "" then return end
  1136.         savedConfigs[name] = { Settings = Settings, Mods_Weapons = Settings.Mods_Weapons, TeamFilter = Settings.TeamFilter }
  1137.         pcall(function() writefile(CONFIG_FILENAME, HttpService:JSONEncode(savedConfigs)) end)
  1138.         rebuildCfgList()
  1139.     end)
  1140.     loadBtn.MouseButton1Click:Connect(function()
  1141.         if not selectedCfg then return end
  1142.         local conf = savedConfigs[selectedCfg]
  1143.         if not conf then return end
  1144.         applyConfig(conf)
  1145.     end)
  1146.     delBtn.MouseButton1Click:Connect(function()
  1147.         if not selectedCfg then return end
  1148.         savedConfigs[selectedCfg] = nil
  1149.         if HAS_FILE then pcall(function() writefile(CONFIG_FILENAME, HttpService:JSONEncode(savedConfigs)) end) end
  1150.         rebuildCfgList()
  1151.     end)
  1152.  
  1153.     local autoLoadBtn = Instance.new("TextButton", configPanel)
  1154.     autoLoadBtn.Size = UDim2.new(0.96,0,0,24)
  1155.     autoLoadBtn.Position = UDim2.new(0.02,0,0, 8 +36 + 118)
  1156.     autoLoadBtn.Text = "Auto Carregar : "..(Settings.AutoLoadConfigs and "ON" or "OFF")
  1157.     autoLoadBtn.BackgroundColor3 = Color3.fromRGB(45,45,45)
  1158.     autoLoadBtn.TextColor3 = Color3.new(1,1,1)
  1159.     Instance.new("UICorner", autoLoadBtn)
  1160.     autoLoadBtn.MouseButton1Click:Connect(function()
  1161.         Settings.AutoLoadConfigs = not Settings.AutoLoadConfigs
  1162.         autoLoadBtn.Text = "Auto Carregar : "..(Settings.AutoLoadConfigs and "ON" or "OFF")
  1163.         if HAS_FILE then pcall(function() writefile(AUTOLOAD_FILENAME, HttpService:JSONEncode({ auto = Settings.AutoLoadConfigs })) end) end
  1164.         if Settings.AutoLoadConfigs then
  1165.             local first = nil
  1166.             for n,_ in pairs(savedConfigs) do first = n; break end
  1167.             if first then selectedCfg = first; applyConfig(savedConfigs[first]); rebuildCfgList() end
  1168.         end
  1169.     end)
  1170. end
  1171.  
  1172. -- ================= FOV drawing
  1173. local fovCircle = nil
  1174. local fovGui = nil
  1175. if HAS_DRAWING then
  1176.     pcall(function()
  1177.         fovCircle = Drawing.new("Circle")
  1178.         fovCircle.NumSides = 64; fovCircle.Thickness = 2; fovCircle.Filled = false
  1179.         fovCircle.Color = Color3.new(1,1,1)
  1180.         fovCircle.Visible = false
  1181.         fovCircle.Radius = Settings.FOVRadius
  1182.     end)
  1183. else
  1184.     pcall(function()
  1185.         fovGui = Instance.new("Frame", gui)
  1186.         fovGui.Name = "FOV_Fallback"
  1187.         fovGui.Size = UDim2.new(0, Settings.FOVRadius*2, 0, Settings.FOVRadius*2)
  1188.         fovGui.Position = UDim2.new(0.5, -Settings.FOVRadius, 0.5, -Settings.FOVRadius)
  1189.         fovGui.BackgroundTransparency = 1
  1190.         fovGui.Visible = false
  1191.         local circ = Instance.new("Frame", fovGui)
  1192.         circ.Size = UDim2.new(1,0,1,0)
  1193.         circ.Position = UDim2.new(0,0,0,0)
  1194.         circ.BackgroundTransparency = 1
  1195.         local corner = Instance.new("UICorner", circ); corner.CornerRadius = UDim.new(1,0)
  1196.         local stroke = Instance.new("UIStroke", circ); stroke.Thickness = 2; stroke.Color = Color3.new(1,1,1)
  1197.     end)
  1198. end
  1199.  
  1200. -- ================= MAIN LOOP =====================
  1201. local UPDATE_RATE = 0.09
  1202. RunService.RenderStepped:Connect(function(dt)
  1203.     pcall(function() updateCameraMovement(dt) end)
  1204.  
  1205.     local ok, candidates = pcall(function() return gatherCandidates() end)
  1206.     if ok and candidates then
  1207.         local bp, bpart = findBestTarget(candidates)
  1208.         if Settings.SilentAim then
  1209.             if bp and bpart then currentPlayer = bp; currentTargetPart = bpart else currentPlayer = nil; currentTargetPart = nil end
  1210.         else currentPlayer = nil; currentTargetPart = nil end
  1211.     else currentPlayer = nil; currentTargetPart = nil end
  1212.  
  1213.     if Settings.ErrarTiros and currentPlayer then cachedMissProb = computeMissProbability(currentPlayer); cachedMissTarget = currentPlayer else cachedMissProb = 0; cachedMissTarget = nil end
  1214.  
  1215.     if fovCircle then pcall(function() fovCircle.Position = Camera.ViewportSize/2; fovCircle.Radius = Settings.FOVRadius; fovCircle.Visible = Settings.ShowFOV end)
  1216.     elseif fovGui then pcall(function() fovGui.Visible = Settings.ShowFOV; fovGui.Size = UDim2.new(0, Settings.FOVRadius*2, 0, Settings.FOVRadius*2); fovGui.Position = UDim2.new(0.5, -Settings.FOVRadius, 0.5, -Settings.FOVRadius) end) end
  1217.  
  1218.     if Settings.ESP then
  1219.         for _,p in ipairs(Players:GetPlayers()) do if p~=LP then pcall(function() updateESPForPlayer(p) end) end end
  1220.     end
  1221. end)
  1222.  
  1223. -- fallback cleanup loop
  1224. task.spawn(function()
  1225.     while true do
  1226.         if not Settings.ESP then
  1227.             for _,p in ipairs(Players:GetPlayers()) do pcall(function() clearESPForPlayer(p) end) end
  1228.         end
  1229.         task.wait(UPDATE_RATE)
  1230.     end
  1231. end)
  1232.  
  1233. -- Tool camera fix
  1234. local function connectToolCameraFix(tool)
  1235.     if not tool then return end
  1236.     if tool:IsA("Tool") then
  1237.         tool.Equipped:Connect(function() task.defer(function() pcall(function() Camera.CameraSubject = LP.Character:FindFirstChildOfClass("Humanoid") end) end) end)
  1238.         tool.Unequipped:Connect(function() task.defer(function() pcall(function() Camera.CameraSubject = LP.Character:FindFirstChildOfClass("Humanoid") end) end) end)
  1239.     end
  1240. end
  1241. local function scanToolsForCamera()
  1242.     if LP.Character then for _,c in ipairs(LP.Character:GetChildren()) do if c:IsA("Tool") then connectToolCameraFix(c) end end end
  1243. end
  1244. if LP.Character then scanToolsForCamera() end
  1245. LP.CharacterAdded:Connect(function() task.wait(0.1); scanToolsForCamera() end)
  1246.  
  1247. -- Cleanup on exit
  1248. LP.AncestryChanged:Connect(function()
  1249.     if not LP:IsDescendantOf(game) then
  1250.         if HAS_DRAWING and fovCircle then pcall(function() fovCircle.Visible=false; fovCircle:Remove() end) end
  1251.         if fovGui then pcall(function() fovGui:Destroy() end) end
  1252.         for p,_ in pairs(espCache) do clearESPForPlayer(p) end
  1253.         if gui and gui.Parent then pcall(function() gui:Destroy() end) end
  1254.         if optimizationApplied then pcall(function() applyOptimization(false) end) end
  1255.     end
  1256. end)
  1257.  
  1258. -- Auto-apply Optimization at start if Settings.Optimization true
  1259. if Settings.Optimization then pcall(function() applyOptimization(true) end) end
  1260.  
  1261. -- Final prints
  1262. if not CAN_HOOK then warn("[DeltaFinal] Hook limitado.") else print("[DeltaFinal] Hook ativo.") end
  1263. if not HAS_DRAWING then print("[DeltaFinal] Drawing indisponível: FOV usa fallback GUI.") end
  1264. if not HAS_FILE then print("[DeltaFinal] writefile/readfile indisponível: salvar configs desativado.") end
  1265.  
  1266. print("✅ SCRIPT FINAL (Tremor ao pegar armas) carregado — cole como LocalScript em StarterPlayer -> StarterPlayerScripts")
  1267. --====================================================
  1268. -- Fim do SCRIPT FINAL
  1269. --====================================================
Advertisement
Add Comment
Please, Sign In to add comment