-- by skrt thanks for using 🎯 local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local Workspace = game:GetService("Workspace") local lp = Players.LocalPlayer local camera = Workspace.CurrentCamera local gui = Instance.new("ScreenGui") gui.Name = "LockOnGUI" gui.IgnoreGuiInset = true gui.ResetOnSpawn = false gui.Parent = lp:WaitForChild("PlayerGui") local panel = Instance.new("Frame") panel.Name = "Panel" panel.Size = UDim2.fromOffset(230, 140) panel.Position = UDim2.new(0.5, -115, 0.5, -70) panel.BackgroundColor3 = Color3.fromRGB(20,20,25) panel.BorderSizePixel = 0 panel.Active = true panel.Parent = gui local corner = Instance.new("UICorner", panel) corner.CornerRadius = UDim.new(0,10) local title = Instance.new("TextLabel") title.BackgroundTransparency = 1 title.Size = UDim2.new(1, -12, 0, 26) title.Position = UDim2.new(0, 6, 0, 6) title.Font = Enum.Font.GothamBold title.TextSize = 18 title.TextColor3 = Color3.fromRGB(255,255,255) title.TextXAlignment = Enum.TextXAlignment.Left title.Text = "Aimbot" title.Parent = panel local btn = Instance.new("TextButton") btn.Size = UDim2.fromOffset(198, 34) btn.Position = UDim2.new(0, 16, 0, 36) btn.Font = Enum.Font.GothamBold btn.TextSize = 16 btn.Text = "OFF (L)" btn.BackgroundColor3 = Color3.fromRGB(40,40,50) btn.TextColor3 = Color3.fromRGB(255,255,255) btn.AutoButtonColor = true btn.Parent = panel local btnCorner = Instance.new("UICorner", btn) btnCorner.CornerRadius = UDim.new(0,8) local espBtn = Instance.new("TextButton") espBtn.Size = UDim2.fromOffset(198, 34) espBtn.Position = UDim2.new(0, 16, 0, 76) espBtn.Font = Enum.Font.GothamBold espBtn.TextSize = 16 espBtn.Text = "ESP: ON" espBtn.BackgroundColor3 = Color3.fromRGB(0,200,120) espBtn.TextColor3 = Color3.fromRGB(255,255,255) espBtn.AutoButtonColor = true espBtn.Parent = panel local espBtnCorner = Instance.new("UICorner", espBtn) espBtnCorner.CornerRadius = UDim.new(0,8) local tag = Instance.new("TextLabel") tag.BackgroundTransparency = 1 tag.Size = UDim2.new(1, -12, 0, 18) tag.Position = UDim2.new(0, 6, 1, -22) tag.Font = Enum.Font.GothamSemibold tag.TextSize = 14 tag.TextXAlignment = Enum.TextXAlignment.Left tag.TextColor3 = Color3.fromRGB(200,200,200) tag.Text = "Target: none" tag.Parent = panel do local dragging, dragStart, startPos panel.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then dragging = true dragStart = input.Position startPos = panel.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false end end) end end) UserInputService.InputChanged:Connect(function(input) if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then local delta = input.Position - dragStart panel.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y) end end) end local function getCharacter(plr) local c = plr.Character if not c or not c.Parent then return end local hum = c:FindFirstChildOfClass("Humanoid") local head = c:FindFirstChild("Head") if hum and hum.Health > 0 and head and head:IsA("BasePart") then return c, hum, head end end local function hasLineOfSightTo(head) if not head or not head.Parent then return false end local origin = camera.CFrame.Position local dir = head.Position - origin if dir.Magnitude < 1e-3 then return true end local params = RaycastParams.new() params.FilterType = Enum.RaycastFilterType.Exclude params.FilterDescendantsInstances = { lp.Character } local result = Workspace:Raycast(origin, dir, params) if not result then return true end local model = head:FindFirstAncestorOfClass("Model") return result.Instance and model and result.Instance:IsDescendantOf(model) end local function mouseHeadIfLOS() local mouse = lp:GetMouse() local part = mouse.Target if not part then return end local model = part:FindFirstAncestorOfClass("Model") if not model then return end local pl = Players:GetPlayerFromCharacter(model) if not pl or pl == lp then return end local _, _, head = getCharacter(pl) if head and hasLineOfSightTo(head) then return head end end local function nearestVisibleHead() local myChar = lp.Character local root = myChar and myChar:FindFirstChild("HumanoidRootPart") if not root then return end local bestHead, bestDist for _, pl in ipairs(Players:GetPlayers()) do if pl ~= lp then local _, _, head = getCharacter(pl) if head and hasLineOfSightTo(head) then local d = (head.Position - root.Position).Magnitude if not bestDist or d < bestDist then bestHead, bestDist = head, d end end end end return bestHead end local function ownerNameFromHead(head) local mdl = head and head:FindFirstAncestorOfClass("Model") local p = mdl and Players:GetPlayerFromCharacter(mdl) return p and p.Name or "unknown" end local on = false local currentHead local rsConn local function updateUI() btn.Text = (on and "ON" or "OFF") .. " (L)" btn.BackgroundColor3 = on and Color3.fromRGB(0,120,255) or Color3.fromRGB(40,40,50) tag.Text = currentHead and ("Target: "..ownerNameFromHead(currentHead)) or "Target: none" end local function aimAt(head) camera.CameraType = Enum.CameraType.Custom local pos = camera.CFrame.Position camera.CFrame = CFrame.new(pos, head.Position) local hum = lp.Character and lp.Character:FindFirstChildOfClass("Humanoid") if hum then camera.CameraSubject = hum end end local function step() if not on then return end if currentHead then local mdl = currentHead:FindFirstAncestorOfClass("Model") local hum = mdl and mdl:FindFirstChildOfClass("Humanoid") if not hum or hum.Health <= 0 or not hasLineOfSightTo(currentHead) then currentHead = nil updateUI() end end if not currentHead then currentHead = mouseHeadIfLOS() or nearestVisibleHead() if currentHead then updateUI() end end if currentHead and hasLineOfSightTo(currentHead) then aimAt(currentHead) else camera.CameraType = Enum.CameraType.Custom end end local function start() if rsConn then rsConn:Disconnect() end rsConn = RunService.RenderStepped:Connect(step) end local function stop() if rsConn then rsConn:Disconnect(); rsConn = nil end currentHead = nil camera.CameraType = Enum.CameraType.Custom local hum = lp.Character and lp.Character:FindFirstChildOfClass("Humanoid") if hum then camera.CameraSubject = hum end updateUI() end local function toggle() on = not on updateUI() if on then start() else stop() end end btn.MouseButton1Click:Connect(toggle) UserInputService.InputBegan:Connect(function(input, gp) if gp then return end if input.KeyCode == Enum.KeyCode.L then toggle() elseif input.UserInputType == Enum.UserInputType.MouseButton1 and on then local h = mouseHeadIfLOS() if h then currentHead = h updateUI() end end end) Players.LocalPlayer.CharacterAdded:Connect(function() if on then stop(); task.wait(0.1); start() end end) updateUI() local espOn = true local espCache = {} local function destroyESP(plr) local entry = espCache[plr] if entry then if entry.hl and entry.hl.Parent then entry.hl:Destroy() end if entry.bb and entry.bb.Parent then entry.bb:Destroy() end espCache[plr] = nil end end local function applyESP(plr) if not espOn then return end if plr == lp then return end local char, hum, head = getCharacter(plr) if not char or not head then return end if espCache[plr] and espCache[plr].char == char then return end destroyESP(plr) local hl = Instance.new("Highlight") hl.Name = "LockOnESP" hl.FillTransparency = 1 hl.OutlineTransparency = 0 hl.OutlineColor = Color3.fromRGB(0,255,140) hl.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop hl.Adornee = char hl.Parent = char local bb = Instance.new("BillboardGui") bb.Name = "NameTagESP" bb.Size = UDim2.fromOffset(200, 40) bb.AlwaysOnTop = true bb.MaxDistance = 500 bb.StudsOffset = Vector3.new(0, 3, 0) bb.Adornee = head bb.Parent = head local tl = Instance.new("TextLabel") tl.BackgroundTransparency = 1 tl.Size = UDim2.new(1,0,1,0) tl.TextScaled = true tl.Font = Enum.Font.GothamBold tl.Text = plr.Name tl.TextColor3 = Color3.new(1,1,1) tl.Parent = bb espCache[plr] = { hl = hl, bb = bb, char = char } end local function trackPlayer(plr) if plr == lp then return end plr.CharacterAdded:Connect(function(char) if not espOn then return end task.defer(function() char:WaitForChild("Head", 10) applyESP(plr) end) end) if plr.Character then task.defer(function() applyESP(plr) end) end end for _, p in ipairs(Players:GetPlayers()) do trackPlayer(p) end Players.PlayerAdded:Connect(trackPlayer) Players.PlayerRemoving:Connect(function(plr) destroyESP(plr) end) local function setESP(state) espOn = state espBtn.Text = "ESP: " .. (espOn and "ON" or "OFF") espBtn.BackgroundColor3 = espOn and Color3.fromRGB(0,200,120) or Color3.fromRGB(40,40,50) if not espOn then for p in pairs(espCache) do destroyESP(p) end else for _, p in ipairs(Players:GetPlayers()) do applyESP(p) end end end espBtn.MouseButton1Click:Connect(function() setESP(not espOn) end)