-- Universal Roblox Aimlock + ESP (with Top Right Status) -- Press R = Toggle Aimlock -- Press T = Toggle ESP local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local RunService = game:GetService("RunService") local Workspace = game:GetService("Workspace") local LocalPlayer = Players.LocalPlayer local Camera = Workspace.CurrentCamera local Locked = false local Target = nil local Connection = nil local ESPConnection = nil local Config = { AimKey = Enum.KeyCode.R, ESPKey = Enum.KeyCode.T, TargetPart = "Head", Smoothness = 0.25, MaxESPDistance = 800, } -- ================== STATUS GUI ================== local ScreenGui = Instance.new("ScreenGui") ScreenGui.Name = "AimlockESP" ScreenGui.ResetOnSpawn = false ScreenGui.Parent = LocalPlayer:WaitForChild("PlayerGui") local StatusLabel = Instance.new("TextLabel") StatusLabel.Size = UDim2.new(0, 220, 0, 60) StatusLabel.Position = UDim2.new(1, -230, 0, 10) StatusLabel.BackgroundColor3 = Color3.fromRGB(20, 20, 20) StatusLabel.BackgroundTransparency = 0.3 StatusLabel.TextColor3 = Color3.fromRGB(255, 255, 255) StatusLabel.Font = Enum.Font.GothamBold StatusLabel.TextSize = 16 StatusLabel.Text = "Aimlock: OFF\nESP: OFF" StatusLabel.TextStrokeTransparency = 0.6 StatusLabel.Parent = ScreenGui local UICorner = Instance.new("UICorner") UICorner.CornerRadius = UDim.new(0, 8) UICorner.Parent = StatusLabel -- =============================================== -- ================== ESP ================== local ESP = {} local Drawings = {} local function CreateESP(player) if player == LocalPlayer then return end local box = Drawing.new("Square") box.Thickness = 2 box.Filled = false box.Transparency = 1 box.Color = Color3.fromRGB(255, 50, 50) local name = Drawing.new("Text") name.Size = 16 name.Center = true name.Outline = true name.Color = Color3.fromRGB(255, 255, 255) local healthBar = Drawing.new("Square") -- Background local healthBarFill = Drawing.new("Square") -- Fill Drawings[player] = {box = box, name = name, healthBar = healthBar, healthBarFill = healthBarFill} end local function UpdateESP() for player, drawings in pairs(Drawings) do if not player or not player.Character then drawings.box.Visible = false drawings.name.Visible = false drawings.healthBar.Visible = false drawings.healthBarFill.Visible = false continue end local character = player.Character local root = character:FindFirstChild("HumanoidRootPart") local humanoid = character:FindFirstChildOfClass("Humanoid") local head = character:FindFirstChild("Head") if not root or not humanoid or humanoid.Health <= 0 then drawings.box.Visible = false drawings.name.Visible = false drawings.healthBar.Visible = false drawings.healthBarFill.Visible = false continue end local distance = (Camera.CFrame.Position - root.Position).Magnitude if distance > Config.MaxESPDistance then drawings.box.Visible = false drawings.name.Visible = false drawings.healthBar.Visible = false drawings.healthBarFill.Visible = false continue end -- World to Viewport local screenPos, onScreen = Camera:WorldToViewportPoint(root.Position) if not onScreen then drawings.box.Visible = false drawings.name.Visible = false drawings.healthBar.Visible = false drawings.healthBarFill.Visible = false continue end local top = Camera:WorldToViewportPoint(head.Position + Vector3.new(0, 2.5, 0)) local bottom = Camera:WorldToViewportPoint(root.Position - Vector3.new(0, 3, 0)) local height = math.abs(top.Y - bottom.Y) local width = height / 2.2 -- Box drawings.box.Size = Vector2.new(width, height) drawings.box.Position = Vector2.new(top.X - width/2, top.Y) drawings.box.Visible = true -- Name + Distance drawings.name.Text = string.format("%s [%d]", player.Name, math.floor(distance)) drawings.name.Position = Vector2.new(top.X, top.Y - 20) drawings.name.Visible = true -- Health Bar local healthPercent = humanoid.Health / humanoid.MaxHealth drawings.healthBar.Size = Vector2.new(4, height) drawings.healthBar.Position = Vector2.new(top.X - width/2 - 8, top.Y) drawings.healthBar.Color = Color3.fromRGB(0, 0, 0) drawings.healthBar.Visible = true drawings.healthBarFill.Size = Vector2.new(4, height * healthPercent) drawings.healthBarFill.Position = Vector2.new(top.X - width/2 - 8, top.Y + height * (1 - healthPercent)) drawings.healthBarFill.Color = Color3.fromRGB(0, 255, 0) drawings.healthBarFill.Visible = true end end local function ToggleESP(enable) if enable then if not ESPConnection then for _, player in ipairs(Players:GetPlayers()) do CreateESP(player) end ESPConnection = RunService.RenderStepped:Connect(UpdateESP) end else if ESPConnection then ESPConnection:Disconnect() ESPConnection = nil end for _, drawings in pairs(Drawings) do drawings.box:Remove() drawings.name:Remove() drawings.healthBar:Remove() drawings.healthBarFill:Remove() end Drawings = {} end end -- ================== AIMLOCK ================== local function Unlock() Locked = false Target = nil if Connection then Connection:Disconnect() Connection = nil end StatusLabel.Text = "Aimlock: OFF\nESP: " .. (ESPConnection and "ON" or "OFF") end local function GetClosestPlayer() local character = LocalPlayer.Character local root = character and character:FindFirstChild("HumanoidRootPart") if not root then return nil end local closest = nil local shortest = math.huge for _, player in ipairs(Players:GetPlayers()) do if player ~= LocalPlayer and player.Character then local targetPart = player.Character:FindFirstChild(Config.TargetPart) local targetRoot = player.Character:FindFirstChild("HumanoidRootPart") local humanoid = player.Character:FindFirstChildOfClass("Humanoid") if targetPart and targetRoot and humanoid and humanoid.Health > 0 then local dist = (root.Position - targetRoot.Position).Magnitude if dist < shortest then shortest = dist closest = player end end end end return closest end local function Lock() Target = GetClosestPlayer() if not Target then print("No target found") return false end Locked = true StatusLabel.Text = "Aimlock: ON\nESP: " .. (ESPConnection and "ON" or "OFF") print("Aimlock Locked on: " .. Target.Name) Connection = RunService.RenderStepped:Connect(function() if not Target or not Target.Character then Unlock() return end local targetPart = Target.Character:FindFirstChild(Config.TargetPart) if not targetPart then Unlock() return end local currentCFrame = Camera.CFrame local targetCFrame = CFrame.lookAt(currentCFrame.Position, targetPart.Position) Camera.CFrame = currentCFrame:Lerp(targetCFrame, Config.Smoothness) end) end -- ================== INPUT ================== UserInputService.InputBegan:Connect(function(input, gp) if gp then return end if input.KeyCode == Config.AimKey then if Locked then Unlock() else Lock() end elseif input.KeyCode == Config.ESPKey then ToggleESP(not ESPConnection) StatusLabel.Text = "Aimlock: " .. (Locked and "ON" or "OFF") .. "\nESP: " .. (ESPConnection and "ON" or "OFF") end end) -- Auto cleanup LocalPlayer.CharacterAdded:Connect(Unlock) Players.PlayerAdded:Connect(CreateESP) print("✅ Aimlock + ESP loaded!") print("R = Aimlock | T = ESP")