Aim lock
Key RequiredUniversal

Aim lock

Universal Scripthataim696hataim696 3.5K views 68.1K executesUpdated Aug 15, 2026
Unrated
00
Lua Script•255 lines (5842 chars)
--// Aim Lock + ESP + Name Autocomplete + Minimize Button

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

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

local targetPlayer = nil
local aimLock = false
local espEnabled = false

--// GUI
local gui = Instance.new("ScreenGui")
gui.Name = "AimLockUI"
gui.ResetOnSpawn = false
gui.Parent = LocalPlayer:WaitForChild("PlayerGui")

--// Main Frame
local frame = Instance.new("Frame")
frame.Size = UDim2.fromOffset(280, 200)
frame.Position = UDim2.new(0.5, -140, 0.5, -100)
frame.BackgroundColor3 = Color3.fromRGB(25, 25, 30)
frame.BorderSizePixel = 0
frame.Parent = gui

--// Title
local title = Instance.new("TextLabel")
title.Size = UDim2.new(1, -45, 0, 40)
title.Text = "Aim Lock"
title.TextScaled = true
title.TextColor3 = Color3.new(1,1,1)
title.BackgroundTransparency = 1
title.Parent = frame

--// Minus Button
local minus = Instance.new("TextButton")
minus.Size = UDim2.fromOffset(40, 40)
minus.Position = UDim2.new(1, -40, 0, 0)
minus.Text = "−"
minus.TextScaled = true
minus.TextColor3 = Color3.new(1,1,1)
minus.BackgroundTransparency = 1
minus.Parent = frame

--// Search Box
local box = Instance.new("TextBox")
box.Size = UDim2.new(1, -20, 0, 40)
box.Position = UDim2.fromOffset(10, 50)
box.PlaceholderText = "اكتب أول حرفين من الاسم"
box.Text = ""
box.TextColor3 = Color3.new(1,1,1)
box.Parent = frame

--// Suggestion
local suggestion = Instance.new("TextLabel")
suggestion.Size = UDim2.new(1, -20, 0, 25)
suggestion.Position = UDim2.fromOffset(10, 92)
suggestion.Text = ""
suggestion.TextColor3 = Color3.new(1,1,1)
suggestion.BackgroundTransparency = 1
suggestion.Parent = frame

--// Aim Button
local aimButton = Instance.new("TextButton")
aimButton.Size = UDim2.new(0.48, 0, 0, 40)
aimButton.Position = UDim2.fromOffset(10, 130)
aimButton.Text = "Aim: OFF"
aimButton.Parent = frame

--// ESP Button
local espButton = Instance.new("TextButton")
espButton.Size = UDim2.new(0.48, 0, 0, 40)
espButton.Position = UDim2.new(0.52, 0, 0, 130)
espButton.Text = "ESP: OFF"
espButton.Parent = frame

--// Floating X Button
local floating = Instance.new("TextButton")
floating.Size = UDim2.fromOffset(65, 65)
floating.Position = UDim2.new(0.5, -32, 0.5, -32)
floating.Text = "X"
floating.TextScaled = true
floating.TextColor3 = Color3.new(1,1,1)
floating.BackgroundColor3 = Color3.fromRGB(35,35,40)
floating.Visible = false
floating.Parent = gui

local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(1,0)
corner.Parent = floating

--// Minimize
minus.MouseButton1Click:Connect(function()
	frame.Visible = false
	floating.Visible = true
end)

--// Restore
floating.MouseButton1Click:Connect(function()
	frame.Visible = true
	floating.Visible = false
end)

--// Drag X button
local dragging = false
local dragStart
local startPos

floating.InputBegan:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1
	or input.UserInputType == Enum.UserInputType.Touch then

		dragging = true
		dragStart = input.Position
		startPos = floating.Position

		input.Changed:Connect(function()
			if input.UserInputState == Enum.UserInputState.End then
				dragging = false
			end
		end)
	end
end)

UserInputService.InputChanged:Connect(function(input)
	if not dragging then
		return
	end

	if input.UserInputType == Enum.UserInputType.MouseMovement
	or input.UserInputType == Enum.UserInputType.Touch then

		local delta = input.Position - dragStart

		floating.Position = UDim2.new(
			startPos.X.Scale,
			startPos.X.Offset + delta.X,
			startPos.Y.Scale,
			startPos.Y.Offset + delta.Y
		)
	end
end)

--// Find Player
local function findPlayer(text)
	text = text:lower()

	if #text < 2 then
		return nil
	end

	for _, player in ipairs(Players:GetPlayers()) do
		if player ~= LocalPlayer then
			if player.Name:lower():sub(1, #text) == text then
				return player
			end
		end
	end

	return nil
end

box:GetPropertyChangedSignal("Text"):Connect(function()
	local player = findPlayer(box.Text)

	if player then
		targetPlayer = player
		suggestion.Text = "Target: " .. player.Name
	else
		targetPlayer = nil
		suggestion.Text = "No player found"
	end
end)

--// Aim Lock
aimButton.MouseButton1Click:Connect(function()
	if not targetPlayer then
		return
	end

	aimLock = not aimLock
	aimButton.Text = aimLock and "Aim: ON" or "Aim: OFF"
end)

RunService.RenderStepped:Connect(function()
	if not aimLock or not targetPlayer then
		return
	end

	local character = targetPlayer.Character

	if not character then
		return
	end

	local torso = character:FindFirstChild("HumanoidRootPart")

	if torso then
		Camera.CFrame = CFrame.lookAt(
			Camera.CFrame.Position,
			torso.Position
		)
	end
end)

--// ESP
local function addESP(player)
	if player == LocalPlayer then
		return
	end

	local function setup(character)
		local highlight = character:FindFirstChild("AimLockESP")

		if not highlight then
			highlight = Instance.new("Highlight")
			highlight.Name = "AimLockESP"
			highlight.FillTransparency = 0.5
			highlight.OutlineTransparency = 0
			highlight.Parent = character
		end

		highlight.Enabled = espEnabled
	end

	player.CharacterAdded:Connect(setup)

	if player.Character then
		setup(player.Character)
	end
end

for _, player in ipairs(Players:GetPlayers()) do
	addESP(player)
end

Players.PlayerAdded:Connect(addESP)

--// ESP Button
espButton.MouseButton1Click:Connect(function()
	espEnabled = not espEnabled
	espButton.Text = espEnabled and "ESP: ON" or "ESP: OFF"

	for _, player in ipairs(Players:GetPlayers()) do
		if player ~= LocalPlayer and player.Character then
			local highlight = player.Character:FindFirstChild("AimLockESP")

			if highlight then
				highlight.Enabled = espEnabled
			end
		end
	end
end)

Features & Information

Aim lock

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts