0% found this document useful (0 votes)
1K views9 pages

Aimbot Script - Lua 2

Uploaded by

TheOnlyRed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views9 pages

Aimbot Script - Lua 2

Uploaded by

TheOnlyRed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 9

-- ===== UNIVERSAL AIMBOT & ESP BY KLIEL =====

local Players = game:GetService("Players")


local RunService = game:GetService("RunService")
local Workspace = game:GetService("Workspace")
local LocalPlayer = Players.LocalPlayer
local Camera = Workspace.CurrentCamera

-- ===== SETTINGS =====


local FOV = 150
local TargetPart = "Head"
local AimbotEnabled = false
local RageAimbotEnabled = false
local ESPEnabled = false
local VisibleCheckEnabled = true
local TeamCheckEnabled = true
local ESPObjects = {}

-- ===== INTRO SCREEN =====


local ScreenGui = Instance.new("ScreenGui", game.CoreGui)
ScreenGui.ResetOnSpawn = false
ScreenGui.IgnoreGuiInset = true

local IntroFrame = Instance.new("Frame", ScreenGui)


IntroFrame.Size = UDim2.new(1, 0, 1, 0)
IntroFrame.Position = UDim2.new(0, 0, 0, 0)
IntroFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
IntroFrame.BackgroundTransparency = 0
IntroFrame.ZIndex = 1000

local IntroMessage = Instance.new("TextLabel", IntroFrame)


IntroMessage.Size = UDim2.new(0.8, 0, 0.6, 0)
IntroMessage.Position = UDim2.new(0.1, 0, 0.1, 0)
IntroMessage.BackgroundTransparency = 1
IntroMessage.Text = "Message from developer: Please note that this script is still
under its very early stages of development and other features like auto shoot and
many more of them will be added in the future. The script was originally tested on
Arsenal and can also work on other games, but some features might not work
perfectly or even not at all. If you enjoyed playing with it, please leave a like
on the scriptblox.com website and support me, love you all!"
IntroMessage.TextColor3 = Color3.fromRGB(255, 255, 255)
IntroMessage.TextTransparency = 0
IntroMessage.Font = Enum.Font.GothamBold
IntroMessage.TextSize = 18
IntroMessage.TextWrapped = true
IntroMessage.TextScaled = false
IntroMessage.TextXAlignment = Enum.TextXAlignment.Center
IntroMessage.TextYAlignment = Enum.TextYAlignment.Center
IntroMessage.ZIndex = 1001

local CountdownTimer = Instance.new("TextLabel", IntroFrame)


CountdownTimer.Size = UDim2.new(0.2, 0, 0.1, 0)
CountdownTimer.Position = UDim2.new(0.4, 0, 0.75, 0)
CountdownTimer.BackgroundTransparency = 1
CountdownTimer.Text = "18"
CountdownTimer.TextColor3 = Color3.fromRGB(255, 255, 255)
CountdownTimer.TextTransparency = 0
CountdownTimer.Font = Enum.Font.GothamBold
CountdownTimer.TextSize = 24
CountdownTimer.TextWrapped = true
CountdownTimer.TextScaled = false
CountdownTimer.TextXAlignment = Enum.TextXAlignment.Center
CountdownTimer.TextYAlignment = Enum.TextYAlignment.Center
CountdownTimer.ZIndex = 1001

local SkipButton = Instance.new("TextButton", IntroFrame)


SkipButton.Size = UDim2.new(0.2, 0, 0.1, 0)
SkipButton.Position = UDim2.new(0.4, 0, 0.85, 0)
SkipButton.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
SkipButton.BackgroundTransparency = 0.3
SkipButton.Text = "Skip"
SkipButton.TextColor3 = Color3.fromRGB(0, 255, 150)
SkipButton.TextTransparency = 0
SkipButton.Font = Enum.Font.GothamBold
SkipButton.TextSize = 16
SkipButton.ZIndex = 1001
local SkipCorner = Instance.new("UICorner", SkipButton)
SkipCorner.CornerRadius = UDim.new(0, 8)

-- Fade out function


local function FadeOutIntro()
for i = 0, 1, 0.02 do
IntroFrame.BackgroundTransparency = i
IntroMessage.TextTransparency = i
CountdownTimer.TextTransparency = i
SkipButton.TextTransparency = i
SkipButton.BackgroundTransparency = i
task.wait(0.05)
end
IntroFrame:Destroy()
end

-- Countdown and fade out


local countdownActive = true
task.spawn(function()
for i = 18, 0, -1 do
if not countdownActive then return end
CountdownTimer.Text = tostring(i)
task.wait(1)
end
if countdownActive then
FadeOutIntro()
end
end)

-- Skip button functionality


SkipButton.MouseButton1Click:Connect(function()
countdownActive = false
FadeOutIntro()
end)

-- ===== MAIN GUI =====


local MainFrame = Instance.new("Frame", ScreenGui)
MainFrame.Size = UDim2.new(0, 300, 0, 320)
MainFrame.Position = UDim2.new(0.5, -150, 0.5, -160)
MainFrame.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
MainFrame.BorderSizePixel = 0
MainFrame.Active = true
MainFrame.Draggable = true
MainFrame.Name = "UniversalAimbotByKliel"
MainFrame.Visible = false -- Hide until intro fades out

-- Show MainFrame after intro


task.spawn(function()
while IntroFrame.Parent do
task.wait()
end
task.wait(0.1) -- Small delay to prevent flicker
MainFrame.Visible = true
end)

local UICorner = Instance.new("UICorner", MainFrame)


UICorner.CornerRadius = UDim.new(0, 15)

local Title = Instance.new("TextLabel", MainFrame)


Title.Size = UDim2.new(1, 0, 0, 35)
Title.BackgroundTransparency = 1
Title.Text = "Universal Aimbot By Kliel"
Title.TextColor3 = Color3.fromRGB(0, 255, 150)
Title.Font = Enum.Font.GothamBold
Title.TextSize = 20

-- Button creation function


local function CreateButton(name, posY)
local btn = Instance.new("TextButton", MainFrame)
btn.Size = UDim2.new(0, 260, 0, 40)
btn.Position = UDim2.new(0, 20, 0, posY)
btn.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
btn.TextColor3 = Color3.fromRGB(255, 255, 255)
btn.Text = name .. " OFF"
btn.Font = Enum.Font.GothamSemibold
btn.TextSize = 16
local corner = Instance.new("UICorner", btn)
corner.CornerRadius = UDim.new(0, 12)
return btn
end

local ToggleAimbotBtn = CreateButton("Aimbot", 50)


local ToggleRageAimbotBtn = CreateButton("Rage Aimbot", 100)
local ToggleESPBtn = CreateButton("ESP", 150)
local ToggleVisibleCheckBtn = CreateButton("Visible Check", 200)
local ToggleTeamCheckBtn = CreateButton("Team Check", 250)

-- Initialize button states


ToggleVisibleCheckBtn.Text = "Visible Check ON"
ToggleVisibleCheckBtn.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
ToggleTeamCheckBtn.Text = "Team Check ON"
ToggleTeamCheckBtn.BackgroundColor3 = Color3.fromRGB(0, 255, 0)

-- Minimize button
local MinimizeButton = Instance.new("TextButton", MainFrame)
MinimizeButton.Size = UDim2.new(0, 30, 0, 30)
MinimizeButton.Position = UDim2.new(1, -35, 0, 5)
MinimizeButton.Text = "-"
MinimizeButton.TextColor3 = Color3.fromRGB(0, 255, 150)
MinimizeButton.BackgroundTransparency = 0.3
MinimizeButton.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
local MinCorner = Instance.new("UICorner", MinimizeButton)
MinCorner.CornerRadius = UDim.new(0, 8)

local IsMinimized = false


MinimizeButton.MouseButton1Click:Connect(function()
IsMinimized = not IsMinimized
ToggleAimbotBtn.Visible = not IsMinimized
ToggleRageAimbotBtn.Visible = not IsMinimized
ToggleESPBtn.Visible = not IsMinimized
ToggleVisibleCheckBtn.Visible = not IsMinimized
ToggleTeamCheckBtn.Visible = not IsMinimized
Title.Visible = not IsMinimized
MainFrame.Size = IsMinimized and UDim2.new(0, 100, 0, 40) or UDim2.new(0, 300,
0, 320)
MinimizeButton.Text = IsMinimized and "+" or "-"
end)

-- FOV circle
local FOVCircle = Instance.new("Frame", ScreenGui)
FOVCircle.Size = UDim2.new(0, FOV * 2, 0, FOV * 2)
FOVCircle.AnchorPoint = Vector2.new(0.5, 0.5)
FOVCircle.Position = UDim2.new(0.5, 0, 0.5, 0)
FOVCircle.BackgroundTransparency = 1
FOVCircle.Visible = false

-- Create the actual circle outline using UIStroke


local FOVOutline = Instance.new("Frame", FOVCircle)
FOVOutline.Size = UDim2.new(1, 0, 1, 0)
FOVOutline.BackgroundTransparency = 1
FOVOutline.BorderSizePixel = 0

local FOVStroke = Instance.new("UIStroke", FOVOutline)


FOVStroke.Color = Color3.fromRGB(255, 0, 0)
FOVStroke.Thickness = 2
FOVStroke.Transparency = 0

local FOVCorner = Instance.new("UICorner", FOVOutline)


FOVCorner.CornerRadius = UDim.new(1, 0)

-- ===== AIMBOT LOGIC =====


local function IsVisible(part)
local origin = Camera.CFrame.Position
local direction = part.Position - origin
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Blacklist
params.FilterDescendantsInstances = { LocalPlayer.Character }
local ray = Workspace:Raycast(origin, direction, params)
return not ray or ray.Instance:IsDescendantOf(part.Parent)
end

local function GetClosestPlayer()


local closest = nil
local shortestDist = FOV
local centerX, centerY = Camera.ViewportSize.X / 2, Camera.ViewportSize.Y / 2
for _, player in pairs(Players:GetPlayers()) do
if player ~= LocalPlayer and player.Character and
player.Character:FindFirstChild(TargetPart) then
if not TeamCheckEnabled or player.Team ~= LocalPlayer.Team then
local pos, onScreen =
Camera:WorldToViewportPoint(player.Character[TargetPart].Position)
if onScreen then
local dx = pos.X - centerX
local dy = pos.Y - centerY
local dist = math.sqrt(dx * dx + dy * dy)
if dist < FOV and (not VisibleCheckEnabled or
IsVisible(player.Character[TargetPart])) then
closest = player
shortestDist = dist
end
end
end
end
end
return closest
end

local function GetPlayersInFOV()


local playersInFOV = {}
local centerX, centerY = Camera.ViewportSize.X / 2, Camera.ViewportSize.Y / 2
for _, player in pairs(Players:GetPlayers()) do
if player ~= LocalPlayer and player.Character and
player.Character:FindFirstChild(TargetPart) then
if not TeamCheckEnabled or player.Team ~= LocalPlayer.Team then
local pos, onScreen =
Camera:WorldToViewportPoint(player.Character[TargetPart].Position)
if onScreen then
local dx = pos.X - centerX
local dy = pos.Y - centerY
local dist = math.sqrt(dx * dx + dy * dy)
if dist < FOV and (not VisibleCheckEnabled or
IsVisible(player.Character[TargetPart])) then
table.insert(playersInFOV, player)
end
end
end
end
end
return playersInFOV
end

local aimbotConnection
ToggleAimbotBtn.MouseButton1Click:Connect(function()
AimbotEnabled = not AimbotEnabled
ToggleAimbotBtn.Text = "Aimbot " .. (AimbotEnabled and "ON" or "OFF")
ToggleAimbotBtn.BackgroundColor3 = AimbotEnabled and Color3.fromRGB(0, 255, 0)
or Color3.fromRGB(255, 0, 0)
FOVCircle.Visible = AimbotEnabled
if aimbotConnection then aimbotConnection:Disconnect() end
if AimbotEnabled then
aimbotConnection = RunService.RenderStepped:Connect(function()
local target = GetClosestPlayer()
if target and target.Character and
target.Character:FindFirstChild(TargetPart) then
Camera.CFrame = CFrame.new(Camera.CFrame.Position,
target.Character[TargetPart].Position)
end
end)
end
end)
local rageAimbotConnection
ToggleRageAimbotBtn.MouseButton1Click:Connect(function()
RageAimbotEnabled = not RageAimbotEnabled
ToggleRageAimbotBtn.Text = "Rage Aimbot " .. (RageAimbotEnabled and "ON" or
"OFF")
ToggleRageAimbotBtn.BackgroundColor3 = RageAimbotEnabled and
Color3.fromRGB(255, 165, 0) or Color3.fromRGB(255, 0, 0)
FOVCircle.Visible = RageAimbotEnabled
if rageAimbotConnection then rageAimbotConnection:Disconnect() end
if RageAimbotEnabled then
local currentTargetIndex = 1
rageAimbotConnection = RunService.RenderStepped:Connect(function()
local targets = GetPlayersInFOV()
if #targets > 0 then
local target = targets[currentTargetIndex]
if target and target.Character and
target.Character:FindFirstChild(TargetPart) then
Camera.CFrame = CFrame.new(Camera.CFrame.Position,
target.Character[TargetPart].Position)
end
currentTargetIndex = currentTargetIndex + 1
if currentTargetIndex > #targets then
currentTargetIndex = 1
end
end
end)
end
end)

ToggleVisibleCheckBtn.MouseButton1Click:Connect(function()
VisibleCheckEnabled = not VisibleCheckEnabled
ToggleVisibleCheckBtn.Text = "Visible Check " .. (VisibleCheckEnabled and "ON"
or "OFF")
ToggleVisibleCheckBtn.BackgroundColor3 = VisibleCheckEnabled and
Color3.fromRGB(0, 255, 0) or Color3.fromRGB(255, 0, 0)
end)

ToggleTeamCheckBtn.MouseButton1Click:Connect(function()
TeamCheckEnabled = not TeamCheckEnabled
ToggleTeamCheckBtn.Text = "Team Check " .. (TeamCheckEnabled and "ON" or "OFF")
ToggleTeamCheckBtn.BackgroundColor3 = TeamCheckEnabled and Color3.fromRGB(0,
255, 0) or Color3.fromRGB(255, 0, 0)
end)

-- ===== ESP LOGIC =====


local function CreateESP(player)
if ESPObjects[player] then return end

local character = player.Character


if not character then return end

local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")


local humanoid = character:FindFirstChild("Humanoid")
if not humanoidRootPart or not humanoid then return end

-- Create BillboardGui for name display


local billboardGui = Instance.new("BillboardGui")
billboardGui.Name = "ESP_" .. player.Name
billboardGui.Adornee = humanoidRootPart
billboardGui.Size = UDim2.new(0, 100, 0, 50)
billboardGui.StudsOffset = Vector3.new(0, 3, 0)
billboardGui.AlwaysOnTop = true
billboardGui.Parent = humanoidRootPart

-- Name label
local nameLabel = Instance.new("TextLabel")
nameLabel.Size = UDim2.new(1, 0, 0.5, 0)
nameLabel.BackgroundTransparency = 1
nameLabel.Text = player.Name
nameLabel.TextColor3 = Color3.fromRGB(0, 255, 0)
nameLabel.TextStrokeTransparency = 0
nameLabel.TextStrokeColor3 = Color3.fromRGB(0, 0, 0)
nameLabel.Font = Enum.Font.GothamBold
nameLabel.TextSize = 14
nameLabel.TextScaled = true
nameLabel.Parent = billboardGui

-- Distance label
local distanceLabel = Instance.new("TextLabel")
distanceLabel.Size = UDim2.new(1, 0, 0.5, 0)
distanceLabel.Position = UDim2.new(0, 0, 0.5, 0)
distanceLabel.BackgroundTransparency = 1
distanceLabel.Text = "0m"
distanceLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
distanceLabel.TextStrokeTransparency = 0
distanceLabel.TextStrokeColor3 = Color3.fromRGB(0, 0, 0)
distanceLabel.Font = Enum.Font.Gotham
distanceLabel.TextSize = 12
distanceLabel.TextScaled = true
distanceLabel.Parent = billboardGui

-- Create highlight effect


local highlight = Instance.new("Highlight")
highlight.Name = "ESP_Highlight_" .. player.Name
highlight.Adornee = character
highlight.FillColor = Color3.fromRGB(0, 255, 0)
highlight.FillTransparency = 0.8
highlight.OutlineColor = Color3.fromRGB(0, 255, 0)
highlight.OutlineTransparency = 0.3
highlight.Parent = character

ESPObjects[player] = {
BillboardGui = billboardGui,
DistanceLabel = distanceLabel,
Highlight = highlight,
Humanoid = humanoid
}
end

local function RemoveESP(player)


if ESPObjects[player] then
if ESPObjects[player].BillboardGui then
ESPObjects[player].BillboardGui:Destroy()
end
if ESPObjects[player].Highlight then
ESPObjects[player].Highlight:Destroy()
end
ESPObjects[player] = nil
end
end

local function UpdateESP()


if not ESPEnabled then return end

for _, player in pairs(Players:GetPlayers()) do


if player ~= LocalPlayer and player.Character and
player.Character:FindFirstChild("HumanoidRootPart") then
local isEnemy = not TeamCheckEnabled or player.Team ~= LocalPlayer.Team

if isEnemy then
if not ESPObjects[player] then
CreateESP(player)
end

-- Update distance
if ESPObjects[player] and ESPObjects[player].DistanceLabel then
local distance =
(LocalPlayer.Character.HumanoidRootPart.Position -
player.Character.HumanoidRootPart.Position).Magnitude
ESPObjects[player].DistanceLabel.Text = math.floor(distance) ..
"m"
end

else
RemoveESP(player)
end
else
RemoveESP(player)
end
end
end

-- Update FOV circle position to stay perfectly centered


local function UpdateFOVPosition()
if FOVCircle and FOVCircle.Parent then
FOVCircle.Position = UDim2.new(0.5, 0, 0.5, 0) -- Ensure perfect centering
end
end

-- Clean up ESP when players leave


Players.PlayerRemoving:Connect(function(player)
RemoveESP(player)
end)

-- Clean up ESP when character is removed/reset


Players.PlayerAdded:Connect(function(player)
player.CharacterRemoving:Connect(function()
RemoveESP(player)
end)
end)

-- Handle existing players


for _, player in pairs(Players:GetPlayers()) do
if player ~= LocalPlayer then
player.CharacterRemoving:Connect(function()
RemoveESP(player)
end)
end
end

ToggleESPBtn.MouseButton1Click:Connect(function()
ESPEnabled = not ESPEnabled
ToggleESPBtn.Text = "ESP " .. (ESPEnabled and "ON" or "OFF")
ToggleESPBtn.BackgroundColor3 = ESPEnabled and Color3.fromRGB(0, 255, 0) or
Color3.fromRGB(255, 0, 0)

-- Clean up all ESP when disabled


if not ESPEnabled then
for player, _ in pairs(ESPObjects) do
RemoveESP(player)
end
end
end)

RunService.RenderStepped:Connect(function()
UpdateESP()
UpdateFOVPosition()
end)

You might also like