local Camera = workspace.CurrentCamera
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")
local LocalPlayer = Players.LocalPlayer
_G.AimbotEnabled = false
_G.TeamCheck = false -- If set to true then the script would only lock your aim at enemy team members.
_G.AimPart = "Head" -- Where the aimbot script would lock at.
_G.Sensitivity = 0 -- How many seconds it takes for the aimbot script to officially lock onto the target's aim part.
_G.Prediction = 0.0125 -- Amount of prediction in seconds.
local function GetClosestPlayer()
local MaximumDistance = math.huge
local Target = nil
for _, v in next, Players:GetPlayers() do
if v.Name ~= LocalPlayer.Name then
if _G.TeamCheck == true then
if v.Team ~= LocalPlayer.Team then
if v.Character ~= nil then
if v.Character:FindFirstChild("HumanoidRootPart") ~= nil then
if v.Character:FindFirstChild("Humanoid") ~= nil and v.Character:FindFirstChild("Humanoid").Health ~= 0 then
local Humanoid = v.Character:FindFirstChild("Humanoid")
local HumanoidRootPart = v.Character:FindFirstChild("HumanoidRootPart")
if Humanoid and HumanoidRootPart then
local Velocity = HumanoidRootPart.Velocity
local PredictionOffset = Velocity * _G.Prediction
local ScreenPoint = Camera:WorldToScreenPoint((HumanoidRootPart.Position + PredictionOffset))
local VectorDistance = (Vector2.new(UserInputService:GetMouseLocation().X, UserInputService:GetMouseLocation().Y) - Vector2.new(ScreenPoint.X, ScreenPoint.Y)).Magnitude
if VectorDistance < MaximumDistance then
Target = v
MaximumDistance = VectorDistance
end
end
end
end
end
end
else
if v.Character ~= nil then
if v.Character:FindFirstChild("HumanoidRootPart") ~= nil then
if v.Character:FindFirstChild("Humanoid") ~= nil and v.Character:FindFirstChild("Humanoid").Health ~= 0 then
local Humanoid = v.Character:FindFirstChild("Humanoid")
local HumanoidRootPart = v.Character:FindFirstChild("HumanoidRootPart")
if Humanoid and HumanoidRootPart then
local Velocity = HumanoidRootPart.Velocity
local PredictionOffset = Velocity * _G.Prediction
local ScreenPoint = Camera:WorldToScreenPoint((HumanoidRootPart.Position + PredictionOffset))
local VectorDistance = (Vector2.new(UserInputService:GetMouseLocation().X, UserInputService:GetMouseLocation().Y) - Vector2.new(ScreenPoint.X, ScreenPoint.Y)).Magnitude
if VectorDistance < MaximumDistance then
Target = v
MaximumDistance = VectorDistance
end
end
end
end
end
end
end
end
return Target
end
UserInputService.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.T and not UserInputService:GetFocusedTextBox() then
_G.AimbotEnabled = not _G.AimbotEnabled
end
end)
RunService.RenderStepped:Connect(function()
if _G.AimbotEnabled and UserInputService:GetFocusedTextBox() == nil then
local Target = GetClosestPlayer()
if Target then
local AimPart = Target.Character[_G.AimPart]
if AimPart then
local PredictionOffset = AimPart.Velocity * _G.Prediction
local TargetPosition = AimPart.Position + PredictionOffset
TweenService:Create(Camera, TweenInfo.new(_G.Sensitivity, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {CFrame = CFrame.new(Camera.CFrame.Position, TargetPosition)}):Play()
end
end
end
end)
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")
local LocalPlayer = Players.LocalPlayer
_G.AimbotEnabled = false
_G.TeamCheck = false -- If set to true then the script would only lock your aim at enemy team members.
_G.AimPart = "Head" -- Where the aimbot script would lock at.
_G.Sensitivity = 0 -- How many seconds it takes for the aimbot script to officially lock onto the target's aim part.
_G.Prediction = 0.0125 -- Amount of prediction in seconds.
local function GetClosestPlayer()
local MaximumDistance = math.huge
local Target = nil
for _, v in next, Players:GetPlayers() do
if v.Name ~= LocalPlayer.Name then
if _G.TeamCheck == true then
if v.Team ~= LocalPlayer.Team then
if v.Character ~= nil then
if v.Character:FindFirstChild("HumanoidRootPart") ~= nil then
if v.Character:FindFirstChild("Humanoid") ~= nil and v.Character:FindFirstChild("Humanoid").Health ~= 0 then
local Humanoid = v.Character:FindFirstChild("Humanoid")
local HumanoidRootPart = v.Character:FindFirstChild("HumanoidRootPart")
if Humanoid and HumanoidRootPart then
local Velocity = HumanoidRootPart.Velocity
local PredictionOffset = Velocity * _G.Prediction
local ScreenPoint = Camera:WorldToScreenPoint((HumanoidRootPart.Position + PredictionOffset))
local VectorDistance = (Vector2.new(UserInputService:GetMouseLocation().X, UserInputService:GetMouseLocation().Y) - Vector2.new(ScreenPoint.X, ScreenPoint.Y)).Magnitude
if VectorDistance < MaximumDistance then
Target = v
MaximumDistance = VectorDistance
end
end
end
end
end
end
else
if v.Character ~= nil then
if v.Character:FindFirstChild("HumanoidRootPart") ~= nil then
if v.Character:FindFirstChild("Humanoid") ~= nil and v.Character:FindFirstChild("Humanoid").Health ~= 0 then
local Humanoid = v.Character:FindFirstChild("Humanoid")
local HumanoidRootPart = v.Character:FindFirstChild("HumanoidRootPart")
if Humanoid and HumanoidRootPart then
local Velocity = HumanoidRootPart.Velocity
local PredictionOffset = Velocity * _G.Prediction
local ScreenPoint = Camera:WorldToScreenPoint((HumanoidRootPart.Position + PredictionOffset))
local VectorDistance = (Vector2.new(UserInputService:GetMouseLocation().X, UserInputService:GetMouseLocation().Y) - Vector2.new(ScreenPoint.X, ScreenPoint.Y)).Magnitude
if VectorDistance < MaximumDistance then
Target = v
MaximumDistance = VectorDistance
end
end
end
end
end
end
end
end
return Target
end
UserInputService.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.T and not UserInputService:GetFocusedTextBox() then
_G.AimbotEnabled = not _G.AimbotEnabled
end
end)
RunService.RenderStepped:Connect(function()
if _G.AimbotEnabled and UserInputService:GetFocusedTextBox() == nil then
local Target = GetClosestPlayer()
if Target then
local AimPart = Target.Character[_G.AimPart]
if AimPart then
local PredictionOffset = AimPart.Velocity * _G.Prediction
local TargetPosition = AimPart.Position + PredictionOffset
TweenService:Create(Camera, TweenInfo.new(_G.Sensitivity, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {CFrame = CFrame.new(Camera.CFrame.Position, TargetPosition)}):Play()
end
end
end
end)