Aimlock script open source
Key RequiredUniversal

Aimlock script open source

Universal Scriptneosnappneosnapp 1.7K views 182 executesUpdated Mar 27, 2026
5.0/ 5(3 votes)
30100% Positive
Lua Script•72 lines (2564 chars)
--Used ai fully made by neosnapp
--Pls support me report bugs discord : neo_snap_31882

-- Services
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")

-- Variables
local LocalPlayer = Players.LocalPlayer
local Camera = workspace.CurrentCamera

-- Configuration
local Settings = {
    LockEnabled = false,
    ToggleKey = Enum.KeyCode.C,
    Smoothness = 0.2,            -- 0.1 to 0.5 (PS5 feel)
    TargetPart = "HumanoidRootPart",
    TeamCheck = false            -- Set to true to ignore teammates
}

-- Function to find the NEAREST player by distance (3D Distance)
local function GetNearestPlayer()
    local target = nil
    local shortestDistance = math.huge -- Start with infinity

    for _, player in pairs(Players:GetPlayers()) do
        if player ~= LocalPlayer and player.Character then
            local root = player.Character:FindFirstChild(Settings.TargetPart)
            local hum = player.Character:FindFirstChild("Humanoid")
            local myRoot = LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("HumanoidRootPart")

            if root and hum and hum.Health > 0 and myRoot then
                if Settings.TeamCheck and player.Team == LocalPlayer.Team then
                    continue
                end

                -- Calculate 3D distance between you and the enemy
                local distance = (myRoot.Position - root.Position).Magnitude
                
                -- Check if player is on screen (to avoid snapping to people behind walls)
                local _, isVisible = Camera:WorldToViewportPoint(root.Position)

                if isVisible and distance < shortestDistance then
                    target = root
                    shortestDistance = distance
                end
            end
        end
    end
    return target
end

-- Toggle Input
UserInputService.InputBegan:Connect(function(input, processed)
    if not processed and input.KeyCode == Settings.ToggleKey then
        Settings.LockEnabled = not Settings.LockEnabled
    end
end)

-- Main Loop
RunService:BindToRenderStep("ProximityLock", 201, function()
    if Settings.LockEnabled then
        local target = GetNearestPlayer()
        
        if target then
            -- Smooth PS5-style transition to the nearest body
            local targetCFrame = CFrame.lookAt(Camera.CFrame.Position, target.Position)
            Camera.CFrame = Camera.CFrame:Lerp(targetCFrame, Settings.Smoothness)
        end
    end
end)

Features & Information

C to open lock on locks on to the HumanoidRootPart u can change to Head or Torso or smething like this Used ai fully made by neosnapp.
#Aimlock#Universal#Open source#Lock on#Free

Community Comments (3)

neosnappneosnappMar 27, 2026

used ai fully pls support me report bugs discord : neo_snap_31882

neosnappneosnappMar 27, 2026

''C'' to close/open

it works beautifully, thx a lot for making this

More Scripts for Universal Scripts