Advertisement
bonrwild

Roblox Universal Aimbot Script

Apr 8th, 2025 (edited)
667
1
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.35 KB | Gaming | 1 0
  1. --[[
  2.     Script created by Alex Gaming
  3.     YouTube/Discord/Other: [Optional Contact Info or Channel Link]
  4.     Please do not re-upload or redistribute without credit.
  5. ]]
  6.  
  7. local teamCheck = false
  8. local fov = 120
  9. local lockPart = "HumanoidRootPart"
  10. local aimbotEnabled = false
  11. local espEnabled = true
  12. local headAimEnabled = false
  13. local currentTarget = nil
  14. local currentTargetDistance = "N/A"
  15. local themeColor = Color3.fromRGB(0, 122, 255)
  16.  
  17. local RunService = game:GetService("RunService")
  18. local Players = game:GetService("Players")
  19. local UserInputService = game:GetService("UserInputService")
  20. local Camera = workspace.CurrentCamera
  21.  
  22. -- **ESP Variables**
  23. local highlightedPlayers = {}
  24.  
  25. -- **Create Highlight Function**
  26. local function createHighlight(player)
  27.     local function setupHighlight(character)
  28.         if character:FindFirstChild("HumanoidRootPart") then
  29.             local highlight = Instance.new("Highlight")
  30.             highlight.Adornee = character
  31.             highlight.FillColor = themeColor
  32.             highlight.FillTransparency = 0.5
  33.             highlight.OutlineColor = Color3.new(1, 1, 1)
  34.             highlight.OutlineTransparency = 0.3
  35.             highlight.Enabled = espEnabled
  36.             highlight.Parent = character
  37.  
  38.             highlightedPlayers[player] = highlight
  39.         else
  40.             task.delay(1, function()
  41.                 if character and character:FindFirstChild("HumanoidRootPart") then
  42.                     setupHighlight(character)
  43.                 end
  44.             end)
  45.         end
  46.     end
  47.  
  48.     if player.Character then
  49.         setupHighlight(player.Character)
  50.     end
  51.  
  52.     player.CharacterAdded:Connect(function(character)
  53.         wait(0.5)
  54.         setupHighlight(character)
  55.     end)
  56. end
  57.  
  58. local function removeHighlight(player)
  59.     if highlightedPlayers[player] then
  60.         highlightedPlayers[player]:Destroy()
  61.         highlightedPlayers[player] = nil
  62.     end
  63. end
  64.  
  65. RunService.RenderStepped:Connect(function()
  66.     if espEnabled then
  67.         for _, player in pairs(Players:GetPlayers()) do
  68.             if not highlightedPlayers[player] and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
  69.                 createHighlight(player)
  70.             elseif highlightedPlayers[player] then
  71.                 highlightedPlayers[player].Enabled = espEnabled
  72.             end
  73.         end
  74.     end
  75. end)
  76.  
  77. local function getClosestTarget()
  78.     local closestTarget = nil
  79.     local shortestDistance = math.huge
  80.     local screenCenter = Camera.ViewportSize / 2
  81.     local playerPosition = Players.LocalPlayer.Character and Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart") and Players.LocalPlayer.Character["HumanoidRootPart"].Position or Vector3.new(0, 0, 0)
  82.  
  83.     for _, player in pairs(Players:GetPlayers()) do
  84.         if player ~= Players.LocalPlayer and player.Character then
  85.             local targetPart = headAimEnabled and player.Character:FindFirstChild("Head") or player.Character:FindFirstChild("HumanoidRootPart")
  86.             local humanoid = player.Character:FindFirstChild("Humanoid")
  87.             if targetPart and humanoid and humanoid.Health > 0 then
  88.                 local distanceFromPlayer = (playerPosition - targetPart.Position).Magnitude
  89.                 local screenPoint, onScreen = Camera:WorldToViewportPoint(targetPart.Position)
  90.                 local distanceOnScreen = (Vector2.new(screenPoint.X, screenPoint.Y) - screenCenter).Magnitude
  91.  
  92.                 if onScreen and distanceOnScreen < shortestDistance and distanceOnScreen <= fov then
  93.                     if not teamCheck or player.Team ~= Players.LocalPlayer.Team then
  94.                         closestTarget = player
  95.                         shortestDistance = distanceOnScreen
  96.                         currentTargetDistance = math.floor(distanceFromPlayer)
  97.                     end
  98.                 end
  99.             end
  100.         end
  101.     end
  102.     return closestTarget
  103. end
  104.  
  105. local function lockOnTarget()
  106.     if currentTarget and currentTarget.Character then
  107.         local targetPart = headAimEnabled and currentTarget.Character:FindFirstChild("Head") or currentTarget.Character:FindFirstChild("HumanoidRootPart")
  108.         if targetPart then
  109.             local targetVelocity = targetPart.Velocity or Vector3.new(0, 0, 0)
  110.             local predictionFactor = math.clamp(0.05 + (currentTargetDistance / 2000), 0.02, 0.1)
  111.             local predictedPosition = targetPart.Position + (targetVelocity * predictionFactor)
  112.             Camera.CFrame = Camera.CFrame:Lerp(CFrame.new(Camera.CFrame.Position, predictedPosition), 0.2)
  113.         else
  114.             currentTarget = nil
  115.         end
  116.     end
  117. end
  118.  
  119. RunService.RenderStepped:Connect(function()
  120.     if aimbotEnabled then
  121.         if UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton2) then
  122.             if not currentTarget then
  123.                 currentTarget = getClosestTarget()
  124.             end
  125.             if currentTarget then
  126.                 lockOnTarget()
  127.             end
  128.         else
  129.             currentTarget = nil
  130.         end
  131.     end
  132. end)
  133.  
  134. local function createGUI()
  135.     if game.CoreGui:FindFirstChild("Aimlock_GUI") then
  136.         game.CoreGui.Aimlock_GUI:Destroy()
  137.     end
  138.  
  139.     local ScreenGui = Instance.new("ScreenGui")
  140.     ScreenGui.Name = "Aimlock_GUI"
  141.     ScreenGui.Parent = game.CoreGui
  142.  
  143.     local Frame = Instance.new("Frame", ScreenGui)
  144.     Frame.Size = UDim2.new(0, 200, 0, 190)
  145.     Frame.Position = UDim2.new(1, -220, 0, 50)
  146.     Frame.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
  147.     Frame.BorderSizePixel = 2
  148.     Frame.BorderColor3 = themeColor
  149.  
  150.     local creditLabel = Instance.new("TextLabel", Frame)
  151.     creditLabel.Size = UDim2.new(0, 180, 0, 20)
  152.     creditLabel.Position = UDim2.new(0, 10, 0, 0)
  153.     creditLabel.BackgroundTransparency = 1
  154.     creditLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  155.     creditLabel.TextScaled = true
  156.     creditLabel.Text = "Made by Alex Gaming"
  157.     creditLabel.Name = "CreditLabel"
  158.  
  159.     -- 🔒 Anti-tamper Check
  160.     task.spawn(function()
  161.         while true do
  162.             if creditLabel.Text ~= "Made by Alex Gaming" then
  163.                 warn("Credit tampering detected! Disabling script.")
  164.                 aimbotEnabled = false
  165.                 espEnabled = false
  166.                 headAimEnabled = false
  167.                 if ScreenGui then
  168.                     ScreenGui:Destroy()
  169.                 end
  170.                 break
  171.             end
  172.             wait(2)
  173.         end
  174.     end)
  175.  
  176.     local function createButton(name, position, text, callback)
  177.         local button = Instance.new("TextButton", Frame)
  178.         button.Size = UDim2.new(0, 180, 0, 22)
  179.         button.Position = UDim2.new(0, 10, 0, position)
  180.         button.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
  181.         button.BorderSizePixel = 2
  182.         button.BorderColor3 = themeColor
  183.         button.Text = text
  184.         button.TextColor3 = Color3.fromRGB(255, 255, 255)
  185.         button.TextScaled = true
  186.  
  187.         button.MouseButton1Click:Connect(function()
  188.             callback(button)
  189.         end)
  190.         return button
  191.     end
  192.  
  193.     createButton("Aimlock", 30, "Aimlock: OFF", function(button)
  194.         aimbotEnabled = not aimbotEnabled
  195.         button.Text = aimbotEnabled and "Aimlock: ON" or "Aimlock: OFF"
  196.     end)
  197.  
  198.     createButton("Head Aim", 60, "Head Aim: OFF", function(button)
  199.         headAimEnabled = not headAimEnabled
  200.         button.Text = headAimEnabled and "Head Aim: ON" or "Head Aim: OFF"
  201.     end)
  202.  
  203.     createButton("ESP", 90, "ESP: ON", function(button)
  204.         espEnabled = not espEnabled
  205.         button.Text = espEnabled and "ESP: ON" or "ESP: OFF"
  206.     end)
  207.  
  208.     createButton("Theme Color", 120, "Change Theme", function(button)
  209.         themeColor = themeColor == Color3.fromRGB(0, 122, 255) and Color3.fromRGB(255, 165, 0) or Color3.fromRGB(0, 122, 255)
  210.         Frame.BorderColor3 = themeColor
  211.     end)
  212.  
  213.     local distanceLabel = Instance.new("TextLabel", Frame)
  214.     distanceLabel.Size = UDim2.new(0, 180, 0, 20)
  215.     distanceLabel.Position = UDim2.new(0, 10, 0, 150)
  216.     distanceLabel.BackgroundTransparency = 1
  217.     distanceLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  218.     distanceLabel.TextScaled = true
  219.     distanceLabel.Text = "Distance: N/A"
  220.  
  221.     RunService.RenderStepped:Connect(function()
  222.         distanceLabel.Text = "Distance: " .. tostring(currentTargetDistance) .. "m"
  223.     end)
  224. end
  225.  
  226. createGUI()
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement