--[[
Roblox Aimbot Script - Aim for Head on E Key Press
WITH FRIEND IGNORE SYSTEM
WARNING: This script is for educational purposes only.
Using aimbots in Roblox violates the Terms of Service and can result in a ban.
]]
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local Camera = workspace.CurrentCamera
local LocalPlayer = Players.LocalPlayer
local Mouse = LocalPlayer:GetMouse()
-- Settings
local AIM_KEY = Enum.KeyCode.E
local AIM_FOV = 200 -- Maximum distance to aim at enemies
local AIM_SMOOTHNESS = 1 -- Lower = smoother, higher = faster (0.1 to 0.5 recommended)
local IGNORE_FRIENDS = true -- Set to false if you want to aim at friends too
-- State
local isAiming = false
local targetPlayer = nil
-- Function to check if player is friend
local function IsFriend(player)
if not IGNORE_FRIENDS then return false end
-- Check if player is in friends list
if LocalPlayer:IsFriendsWith(player.UserId) then
return true
end
-- Check if player is in same group (optional - comment out if not needed)
--[[
local groups = LocalPlayer:GetGroups()
for _, group in ipairs(groups) do
if player:IsInGroup(group.Id) then
return true
end
end
]]
return false
end
-- Function to get closest player to mouse/crosshair
local function GetClosestPlayer()
local closestDistance = AIM_FOV
local closestPlayer = nil
local mouseLocation = Vector2.new(Mouse.X, Mouse.Y)
for _, player in ipairs(Players:GetPlayers()) do
-- Skip local player and friends
if player ~= LocalPlayer and not IsFriend(player) then
if player.Character and player.Character:FindFirstChild("Humanoid") and player.Character.Humanoid.Health > 0 then
local head = player.Character:FindFirstChild("Head")
if head then
local headPos, onScreen = Camera:WorldToViewportPoint(head.Position)
if onScreen then
local distance = (Vector2.new(headPos.X, headPos.Y) - mouseLocation).Magnitude
if distance < closestDistance then
closestDistance = distance
closestPlayer = player
end
end
end
end
end
end
return closestPlayer
end
-- Function to aim at player's head
local function AimAtPlayer(player)
if not player or not player.Character then return end
local head = player.Character:FindFirstChild("Head")
if not head then return end
-- Get head position
local headPosition = head.Position
-- Calculate camera direction to head
local cameraPosition = Camera.CFrame.Position
local direction = (headPosition - cameraPosition).Unit
-- Calculate new CFrame for camera
local newCFrame = CFrame.new(cameraPosition, headPosition)
-- Apply smoothing
local currentCFrame = Camera.CFrame
local smoothedCFrame = currentCFrame:Lerp(newCFrame, AIM_SMOOTHNESS)
-- Set camera position
Camera.CFrame = smoothedCFrame
end
-- Input handling
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == AIM_KEY then
isAiming = true
targetPlayer = GetClosestPlayer()
-- Visual feedback (optional)
if targetPlayer then
print("Locked on: " .. targetPlayer.Name)
end
end
end)
UserInputService.InputEnded:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == AIM_KEY then
isAiming = false
targetPlayer = nil
end
end)
-- Main loop
RunService.RenderStepped:Connect(function()
if isAiming then
-- Update target to closest player while holding key
local newTarget = GetClosestPlayer()
if newTarget then
targetPlayer = newTarget
end
if targetPlayer then
AimAtPlayer(targetPlayer)
end
end
end)
-- Visual indicator with friend detection
local function CreateFOVCircle()
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "AimbotGUI"
screenGui.Parent = LocalPlayer:WaitForChild("PlayerGui")
local frame = Instance.new("Frame")
frame.Size = UDim2.new(0, AIM_FOV * 2, 0, AIM_FOV * 2)
frame.Position = UDim2.new(0.5, -AIM_FOV, 0.5, -AIM_FOV)
frame.BackgroundColor3 = Color3.new(1, 0, 0)
frame.BackgroundTransparency = 0.8
frame.BorderSizePixels = 2
frame.BorderColor3 = Color3.new(1, 0, 0)
frame.BackgroundTransparency = 0.9
frame.Parent = screenGui
local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(1, 0)
corner.Parent = frame
-- Status text
local statusText = Instance.new("TextLabel")
statusText.Size = UDim2.new(0, 150, 0, 30)
statusText.Position = UDim2.new(0, 10, 1, -40)
statusText.BackgroundTransparency = 0.5
statusText.BackgroundColor3 = Color3.new(0, 0, 0)
statusText.TextColor3 = Color3.new(0, 1, 0)
statusText.Text = "Aimbot: OFF | Friends: IGNORED"
statusText.Font = Enum.Font.GothamBold
statusText.TextSize = 12
statusText.Parent = screenGui
-- Update status when aiming
RunService.RenderStepped:Connect(function()
if isAiming and targetPlayer then
statusText.Text = "Aimbot: ON | Target: " .. targetPlayer.Name .. " | Friends: IGNORED"
statusText.TextColor3 = Color3.new(1, 0, 0)
elseif isAiming then
statusText.Text = "Aimbot: ON | No target | Friends: IGNORED"
statusText.TextColor3 = Color3.new(1, 0.5, 0)
else
statusText.Text = "Aimbot: OFF | Hold " .. tostring(AIM_KEY):sub(14) .. " | Friends: IGNORED"
statusText.TextColor3 = Color3.new(0, 1, 0)
end
end)
end
-- Uncomment to show FOV circle and status
CreateFOVCircle()
print("Aimbot script loaded with FRIEND IGNORE enabled!")
print("Hold " .. tostring(AIM_KEY):sub(14) .. " to aim at enemy heads (friends are ignored!)")