-- SERVICES local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local Camera = workspace.CurrentCamera -- PLAYER local LocalPlayer = Players.LocalPlayer local PlayerGui = LocalPlayer:WaitForChild("PlayerGui") -- AIM SETTINGS local AIM_SMOOTHNESS = 0.2 local Locking = false -- ESP STORAGE local Highlights = {} -- ========================= -- VALID TARGET CHECK -- ========================= local function isValidTarget(player) if player == LocalPlayer then return false end if not player.Character then return false end if not player.Character:FindFirstChild("Humanoid") then return false end if not player.Character:FindFirstChild("Head") then return false end if player.Team == LocalPlayer.Team then return false end return true end -- ========================= -- ADD HIGHLIGHT ESP (FIXED) -- ========================= local function addHighlight(player) if Highlights[player] then return end if not player.Character then return end local highlight = Instance.new("Highlight") highlight.Adornee = player.Character highlight.FillTransparency = 0.6 highlight.FillColor = Color3.fromRGB(255, 0, 0) highlight.OutlineColor = Color3.fromRGB(255, 0, 0) highlight.OutlineTransparency = 0 highlight.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop -- ✅ THIS IS THE FIX highlight.Parent = PlayerGui Highlights[player] = highlight end -- ========================= -- REMOVE HIGHLIGHT -- ========================= local function removeHighlight(player) if Highlights[player] then Highlights[player]:Destroy() Highlights[player] = nil end end -- ========================= -- INPUT (RIGHT CLICK) -- ========================= UserInputService.InputBegan:Connect(function(input, gpe) if gpe then return end if input.UserInputType == Enum.UserInputType.MouseButton2 then Locking = true end end) UserInputService.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton2 then Locking = false end end) -- ========================= -- GET CLOSEST TARGET -- ========================= local function getClosestTarget() local closest local closestDist = math.huge local mousePos = UserInputService:GetMouseLocation() for _, player in ipairs(Players:GetPlayers()) do if isValidTarget(player) then local head = player.Character.Head local screenPos = Camera:WorldToViewportPoint(head.Position) if screenPos.Z > 0 then local dist = (Vector2.new(screenPos.X, screenPos.Y) - mousePos).Magnitude if dist < closestDist then closestDist = dist closest = player end end end end return closest end -- ========================= -- MAIN LOOP -- ========================= RunService.RenderStepped:Connect(function() -- ESP for _, player in ipairs(Players:GetPlayers()) do if isValidTarget(player) then addHighlight(player) else removeHighlight(player) end end -- AIMBOT if Locking then local target = getClosestTarget() if target and target.Character and target.Character:FindFirstChild("Head") then local headPos = target.Character.Head.Position local current = Camera.CFrame local goal = CFrame.new(current.Position, headPos) Camera.CFrame = current:Lerp(goal, AIM_SMOOTHNESS) end end end) -- CLEANUP Players.PlayerRemoving:Connect(removeHighlight)