QSX Aimlock Universal
Key RequiredUniversal

QSX Aimlock Universal

Universal ScriptWhatafungameWhatafungame 4.5K views 341 executesUpdated Jul 5, 2025
2.5/ 5(2 votes)
1150% Positive
Lua Script•252 lines (7732 chars)
local maxAimlockDistance = 70
local TeamCheck = true
local Smoothness = 0.12
local KeepTarget = false
local IgnoreLowHP = false

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local LocalPlayer = Players.LocalPlayer
local Camera = workspace.CurrentCamera

local lockSound = Instance.new("Sound", LocalPlayer:WaitForChild("PlayerGui"))
lockSound.SoundId = "rbxassetid://12221967"
lockSound.Volume = 1

local aimlockOn = false
local lockedTarget = nil

local screenGui = Instance.new("ScreenGui", LocalPlayer:WaitForChild("PlayerGui"))
screenGui.Name = "QSX_Aimlock_UI"
screenGui.ResetOnSpawn = false

local mainFrame = Instance.new("Frame")
mainFrame.Size = UDim2.new(0, 220, 0, 240)
mainFrame.Position = UDim2.new(0, 20, 0.5, -120)
mainFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
mainFrame.Active = true
mainFrame.Draggable = true
mainFrame.Parent = screenGui

local titleLabel = Instance.new("TextLabel", mainFrame)
titleLabel.Size = UDim2.new(1, 0, 0, 30)
titleLabel.Text = "🎯 QSX Aimlock"
titleLabel.TextColor3 = Color3.new(1, 1, 1)
titleLabel.Font = Enum.Font.GothamBold
titleLabel.TextSize = 18
titleLabel.BackgroundTransparency = 1

local function createButton(name, y, parent)
	local btn = Instance.new("TextButton")
	btn.Size = UDim2.new(0, 180, 0, 30)
	btn.Position = UDim2.new(0.5, -90, 0, y)
	btn.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
	btn.TextColor3 = Color3.new(1, 1, 1)
	btn.Font = Enum.Font.Gotham
	btn.TextSize = 14
	btn.Text = name
	btn.Parent = parent
	return btn
end

local toggleBtn = createButton("Toggle Aimlock: OFF", 35, mainFrame)
local teamBtn = createButton("Team Check: ON", 70, mainFrame)
local keepBtn = createButton("Keep Target: OFF", 105, mainFrame)
local hpBtn = createButton("Ignore Low HP: OFF", 140, mainFrame)

local distanceBox = Instance.new("TextBox", mainFrame)
distanceBox.Size = UDim2.new(0, 180, 0, 30)
distanceBox.Position = UDim2.new(0.5, -90, 0, 175)
distanceBox.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
distanceBox.Text = tostring(maxAimlockDistance)
distanceBox.PlaceholderText = "Distance (0–500)"
distanceBox.TextColor3 = Color3.new(1, 1, 1)
distanceBox.Font = Enum.Font.Gotham
distanceBox.TextSize = 14
distanceBox.ClearTextOnFocus = false

local closeBtn = Instance.new("TextButton", mainFrame)
closeBtn.Size = UDim2.new(0, 24, 0, 24)
closeBtn.Position = UDim2.new(1, -28, 0, 4)
closeBtn.Text = "X"
closeBtn.TextColor3 = Color3.new(1, 0.4, 0.4)
closeBtn.Font = Enum.Font.GothamBold
closeBtn.TextSize = 14
closeBtn.BackgroundTransparency = 1

local reopenBtn = Instance.new("TextButton", screenGui)
reopenBtn.Size = UDim2.new(0, 40, 0, 40)
reopenBtn.Position = UDim2.new(0, 10, 1, -50)
reopenBtn.Text = "≡"
reopenBtn.TextColor3 = Color3.new(1, 1, 1)
reopenBtn.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
reopenBtn.Visible = false

local miniFrame = Instance.new("Frame", screenGui)
miniFrame.Size = UDim2.new(0, 160, 0, 60)
miniFrame.Position = UDim2.new(1, -180, 0.5, -30)
miniFrame.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
miniFrame.Active = true
miniFrame.Draggable = true

local switchBtn = Instance.new("TextButton", miniFrame)
switchBtn.Size = UDim2.new(0, 120, 0, 28)
switchBtn.Position = UDim2.new(0, 20, 0, 5)
switchBtn.Text = "Switch Target"
switchBtn.Font = Enum.Font.Gotham
switchBtn.TextColor3 = Color3.new(1, 1, 1)
switchBtn.BackgroundColor3 = Color3.fromRGB(60, 60, 60)

local miniClose = Instance.new("TextButton", miniFrame)
miniClose.Size = UDim2.new(0, 18, 0, 18)
miniClose.Position = UDim2.new(1, -22, 0, 2)
miniClose.Text = "X"
miniClose.TextColor3 = Color3.new(1, 0.4, 0.4)
miniClose.Font = Enum.Font.GothamBold
miniClose.TextSize = 12
miniClose.BackgroundTransparency = 1

toggleBtn.MouseButton1Click:Connect(function()
	aimlockOn = not aimlockOn
	toggleBtn.Text = "Toggle Aimlock: " .. (aimlockOn and "ON" or "OFF")
	if not aimlockOn then lockedTarget = nil clearESP() end
end)

teamBtn.MouseButton1Click:Connect(function()
	TeamCheck = not TeamCheck
	teamBtn.Text = "Team Check: " .. (TeamCheck and "ON" or "OFF")
end)

keepBtn.MouseButton1Click:Connect(function()
	KeepTarget = not KeepTarget
	keepBtn.Text = "Keep Target: " .. (KeepTarget and "ON" or "OFF")
end)

hpBtn.MouseButton1Click:Connect(function()
	IgnoreLowHP = not IgnoreLowHP
	hpBtn.Text = "Ignore Low HP: " .. (IgnoreLowHP and "ON" or "OFF")
end)

distanceBox.FocusLost:Connect(function()
	local val = tonumber(distanceBox.Text)
	if val and val >= 0 and val <= 500 then
		maxAimlockDistance = val
	else
		distanceBox.Text = tostring(maxAimlockDistance)
	end
end)

closeBtn.MouseButton1Click:Connect(function()
	mainFrame.Visible = false
	reopenBtn.Visible = true
end)

reopenBtn.MouseButton1Click:Connect(function()
	mainFrame.Visible = true
	reopenBtn.Visible = false
end)

miniClose.MouseButton1Click:Connect(function()
	miniFrame.Visible = false
end)

switchBtn.MouseButton1Click:Connect(function()
	local new = getClosestTarget(true)
	if new then
		lockedTarget = new
		lockSound:Play()
		clearESP()
		local torso = getTorso(lockedTarget)
		if torso then createESPCircle(torso) end
	end
end)

UIS.InputBegan:Connect(function(input, gpe)
	if gpe then return end
	if input.KeyCode == Enum.KeyCode.Two then
		aimlockOn = not aimlockOn
		toggleBtn.Text = "Toggle Aimlock: " .. (aimlockOn and "ON" or "OFF")
		if not aimlockOn then lockedTarget = nil clearESP() end
	end
end)

function getTorso(char)
	return char and (char:FindFirstChild("UpperTorso") or char:FindFirstChild("HumanoidRootPart"))
end

function clearESP()
	for _, plr in ipairs(Players:GetPlayers()) do
		if plr.Character then
			local torso = getTorso(plr.Character)
			if torso and torso:FindFirstChild("QSX_ESP") then
				torso.QSX_ESP:Destroy()
			end
		end
	end
end

function createESPCircle(part)
	local gui = Instance.new("BillboardGui", part)
	gui.Name = "QSX_ESP"
	gui.Size = UDim2.new(0, 50, 0, 50)
	gui.AlwaysOnTop = true
	gui.LightInfluence = 0
	gui.Adornee = part

	local frame = Instance.new("Frame", gui)
	frame.Size = UDim2.new(1, 0, 1, 0)
	frame.BackgroundTransparency = 1

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

	local stroke = Instance.new("UIStroke", frame)
	stroke.Color = Color3.fromRGB(255, 70, 100)
	stroke.Thickness = 2
end

function getClosestTarget(force)
	local shortest, target = maxAimlockDistance, nil
	for _, plr in ipairs(Players:GetPlayers()) do
		if plr ~= LocalPlayer and plr.Character then
			if TeamCheck and plr.Team == LocalPlayer.Team then continue end
			local hum = plr.Character:FindFirstChildOfClass("Humanoid")
			local torso = getTorso(plr.Character)
			if hum and torso and hum.Health > 0.1 then
				if IgnoreLowHP and hum.Health < 7 then continue end
				if hum:GetState() == Enum.HumanoidStateType.Physics then continue end
				local dist = (Camera.CFrame.Position - torso.Position).Magnitude
				if dist < shortest then
					shortest = dist
					target = plr
				end
			end
		end
	end
	return target
end

RunService.RenderStepped:Connect(function()
	if aimlockOn then
		if not lockedTarget or not lockedTarget.Character or not getTorso(lockedTarget.Character) then
			if not KeepTarget or not lockedTarget then
				local new = getClosestTarget()
				if new then
					lockedTarget = new
					lockSound:Play()
					clearESP()
					local torso = getTorso(lockedTarget.Character)
					if torso then createESPCircle(torso) end
				end
			end
		end
		if lockedTarget and lockedTarget.Character then
			local torso = getTorso(lockedTarget.Character)
			if torso then
				local cf = CFrame.new(Camera.CFrame.Position, torso.Position)
				Camera.CFrame = Camera.CFrame:Lerp(cf, Smoothness)
			end
		end
	end
end)

Features & Information

Script is in beta might have bug when you switch target.
#Aimlock#Universal#universal#aimlock#op

Community Comments (2)

WhatafungameWhatafungameJul 5, 2025

No ai.slop

WhatafungameWhatafungameJul 22, 2025

Oh that great idea man.

More Scripts for Universal Scripts