
Key Required

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local Workspace = game:GetService("Workspace")
local player = Players.LocalPlayer
local camera = Workspace.CurrentCamera
local playerGui = player:WaitForChild("PlayerGui")
local ENABLED = false
local FOV_RADIUS = 400
local AGGRO_RADIUS = 440
local SMOOTH = 0.25
local TARGET_PART = "Head"
local rayParams = RaycastParams.new()
rayParams.FilterType = Enum.RaycastFilterType.Blacklist
local function updateRayFilter()
if player.Character then
rayParams.FilterDescendantsInstances = { player.Character }
end
end
player.CharacterAdded:Connect(updateRayFilter)
updateRayFilter()
local currentTarget = nil
local lastJump = 0
local jumpCooldown = 0.6
local function isEnemy(plr)
if not plr.Team or not player.Team then
return true
end
return plr.Team ~= player.Team
end
local function hasVision(part, character)
local origin = camera.CFrame.Position
local direction = (part.Position - origin)
local result = Workspace:Raycast(origin, direction, rayParams)
return not result or result.Instance:IsDescendantOf(character)
end
local function isValidTarget(plr)
if not plr or not plr.Character then
return false
end
if not isEnemy(plr) then
return false
end
local head = plr.Character:FindFirstChild(TARGET_PART)
local humanoid = plr.Character:FindFirstChild("Humanoid")
if not head or not humanoid or humanoid.Health <= 0 then
return false
end
local screenPos, onScreen = camera:WorldToViewportPoint(head.Position)
if not onScreen then
return false
end
local center = camera.ViewportSize / 2
local dist2D = (Vector2.new(screenPos.X, screenPos.Y) - center).Magnitude
if dist2D > FOV_RADIUS then
return false
end
return hasVision(head, plr.Character)
end
local function getClosestTarget()
local closest = nil
local closestDist = math.huge
local char = player.Character
local root = char and char:FindFirstChild("HumanoidRootPart")
if not root then
return nil
end
for _, plr in ipairs(Players:GetPlayers()) do
if plr ~= player and isEnemy(plr) and plr.Character then
local hrp = plr.Character:FindFirstChild("HumanoidRootPart")
local head = plr.Character:FindFirstChild(TARGET_PART)
local hum = plr.Character:FindFirstChild("Humanoid")
if hrp and head and hum and hum.Health > 0 and hasVision(head, plr.Character) then
local dist = (hrp.Position - root.Position).Magnitude
if dist < closestDist then
closest = plr
closestDist = dist
end
end
end
end
return closest
end
local function aggressiveMove(targetHRP)
local char = player.Character
if not char then
return
end
local humanoid = char:FindFirstChild("Humanoid")
local root = char:FindFirstChild("HumanoidRootPart")
if not humanoid or not root then
return
end
local dir = (targetHRP.Position - root.Position)
dir = Vector3.new(dir.X, 0, dir.Z)
if dir.Magnitude > 0 then
dir = dir.Unit
end
local strafe = root.CFrame.RightVector * math.sin(time() * 4) * 0.35
humanoid:Move(dir + strafe, false)
if time() - lastJump > jumpCooldown then
humanoid.Jump = true
lastJump = time()
end
end
local gui = Instance.new("ScreenGui", playerGui)
gui.Name = "HeadlockGUI"
gui.ResetOnSpawn = false
local frame = Instance.new("Frame", gui)
frame.Size = UDim2.new(0, 240, 0, 140)
frame.Position = UDim2.new(0, 20, 0.5, -70)
frame.BackgroundColor3 = Color3.fromRGB(20, 20, 30)
frame.BorderSizePixel = 0
Instance.new("UICorner", frame).CornerRadius = UDim.new(0, 12)
local title = Instance.new("TextLabel", frame)
title.Size = UDim2.new(1, 0, 0, 40)
title.Text = "🎯 Headlock + Aggro"
title.BackgroundTransparency = 1
title.TextColor3 = Color3.new(1,1,1)
title.Font = Enum.Font.GothamBold
title.TextScaled = true
local toggle = Instance.new("TextButton", frame)
toggle.Size = UDim2.new(0.9, 0, 0, 50)
toggle.Position = UDim2.new(0.05, 0, 0, 50)
toggle.Text = "OFF"
toggle.Font = Enum.Font.GothamBold
toggle.TextScaled = true
toggle.BackgroundColor3 = Color3.fromRGB(180, 60, 60)
toggle.TextColor3 = Color3.new(1,1,1)
Instance.new("UICorner", toggle).CornerRadius = UDim.new(0, 8)
local status = Instance.new("TextLabel", frame)
status.Size = UDim2.new(1, -20, 0, 25)
status.Position = UDim2.new(0, 10, 1, -30)
status.Text = "Idle"
status.BackgroundTransparency = 1
status.TextColor3 = Color3.new(1,1,1)
status.Font = Enum.Font.Gotham
status.TextScaled = true
toggle.MouseButton1Click:Connect(function()
ENABLED = not ENABLED
toggle.Text = ENABLED and "ON" or "OFF"
toggle.BackgroundColor3 = ENABLED and Color3.fromRGB(60,180,60) or Color3.fromRGB(180,60,60)
currentTarget = nil
end)
RunService.RenderStepped:Connect(function()
updateRayFilter()
if not ENABLED then
status.Text = "Idle"
return
end
currentTarget = getClosestTarget()
if currentTarget and currentTarget.Character then
local head = currentTarget.Character:FindFirstChild(TARGET_PART)
local hrp = currentTarget.Character:FindFirstChild("HumanoidRootPart")
if head and hrp then
status.Text = "Locked: " .. currentTarget.Name
local camCF = CFrame.lookAt(camera.CFrame.Position, head.Position)
camera.CFrame = camera.CFrame:Lerp(camCF, SMOOTH)
local myHRP = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
if myHRP and (hrp.Position - myHRP.Position).Magnitude <= AGGRO_RADIUS then
aggressiveMove(hrp)
end
end
else
status.Text = "Searching..."
end
end)
print("FULL SYSTEM LOADED")



nice script