-- Enhanced Aimbot Script for Roblox

-- Configuration
local aimKey = Enum.KeyCode.E -- Key to activate aimbot
local aimRadius = 100 -- Radius for detecting targets
local aimSmoothness = 0.1 -- Smoothness of the aiming

-- Get Services
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")

local localPlayer = Players.LocalPlayer
local mouse = localPlayer:GetMouse()
local aimEnabled = true

-- Function to get the closest target
local function getClosestTarget()
    local closestTarget = nil
    local closestDistance = aimRadius

    for _, player in pairs(Players:GetPlayers()) do
        if player ~= localPlayer and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
            local distance = (player.Character.HumanoidRootPart.Position - localPlayer.Character.HumanoidRootPart.Position).Magnitude
            if distance < closestDistance then
                closestDistance = distance
                closestTarget = player
            end
        end
    end

    return closestTarget
end

-- Function to aim at the target
local function aimAt(target)
    if target and target.Character and target.Character:FindFirstChild("HumanoidRootPart") then
        local targetPos = target.Character.HumanoidRootPart.Position + Vector3.new(0, 3, 0) -- Adjust the Y axis to aim at the head
        local direction = (targetPos - localPlayer.Character.HumanoidRootPart.Position).unit
        local smoothDirection = localPlayer.Character.HumanoidRootPart.CFrame:lerp(CFrame.new(localPlayer.Character.HumanoidRootPart.Position, localPlayer.Character.HumanoidRootPart.Position + direction), aimSmoothness * RunService.RenderStepped:Wait())

        mouse.TargetFilter = target.Character
        localPlayer.Character.HumanoidRootPart.CFrame = smoothDirection
    end
end

-- Toggle aimbot on key press
UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if gameProcessed then return end

    if input.KeyCode == aimKey then
        aimEnabled = not aimEnabled
    end
end)

-- Main loop
RunService.RenderStepped:Connect(function()
    if aimEnabled then
        local target = getClosestTarget()
        aimAt(target)
    end
end)

print("Aimbot script loaded successfully!")

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: