Advertisement
Paulo87

Best aimbot for mobile

Oct 14th, 2024 (edited)
448
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.90 KB | None | 0 0
  1. local fov, RunService, UserInputService, Players, Cam, CoreGui, isAimbotActive, dragging, dragInput, dragStart, startPos, toggleButton = 100, game:GetService("RunService"), game:GetService("UserInputService"), game:GetService("Players"), game.Workspace.CurrentCamera, game:FindService("CoreGui"), false, false, nil, nil, nil, Instance.new("TextButton")
  2.  
  3. local FOVring, playerNameText = Drawing.new("Circle"), Drawing.new("Text")
  4. FOVring.Visible, FOVring.Thickness, FOVring.Color, FOVring.Filled, FOVring.Radius, FOVring.Position = true, 2, Color3.fromRGB(128, 0, 128), false, fov, Cam.ViewportSize / 2
  5. playerNameText.Visible, playerNameText.Center, playerNameText.Outline, playerNameText.Color, playerNameText.Size, playerNameText.Position = false, true, true, Color3.fromRGB(255, 255, 255), 18, Vector2.new(FOVring.Position.X, FOVring.Position.Y - FOVring.Radius - 20)
  6.  
  7. local function updateDrawings()
  8.     FOVring.Position, playerNameText.Position = Cam.ViewportSize / 2, Vector2.new(FOVring.Position.X, FOVring.Position.Y - FOVring.Radius - 20)
  9. end
  10.  
  11. local function onKeyDown(input)
  12.     if input.KeyCode == Enum.KeyCode.Delete then
  13.         RunService:UnbindFromRenderStep("FOVUpdate")
  14.         FOVring:Remove()
  15.         playerNameText:Remove()
  16.     elseif input.KeyCode == Enum.KeyCode.F5 then
  17.         toggleButton.Visible = not toggleButton.Visible
  18.     end
  19. end
  20.  
  21. UserInputService.InputBegan:Connect(onKeyDown)
  22.  
  23. local function lookAt(target)
  24.     Cam.CFrame = CFrame.new(Cam.CFrame.Position, Cam.CFrame.Position + (target - Cam.CFrame.Position).unit)
  25. end
  26.  
  27. local function getClosestPlayerInFOV(trg_part)
  28.     local nearest, last = nil, math.huge
  29.     for _, player in ipairs(Players:GetPlayers()) do
  30.         if player ~= Players.LocalPlayer and player.Team ~= Players.LocalPlayer.Team then
  31.             local part = player.Character and player.Character:FindFirstChild(trg_part)
  32.             if part then
  33.                 local ePos, isVisible = Cam:WorldToViewportPoint(part.Position)
  34.                 if (Vector2.new(ePos.x, ePos.y) - Cam.ViewportSize / 2).Magnitude < last and isVisible and ePos.Z < fov and not workspace:Raycast(Cam.CFrame.Position, part.Position - Cam.CFrame.Position) then
  35.                     last, nearest = (Vector2.new(ePos.x, ePos.y) - Cam.ViewportSize / 2).Magnitude, player
  36.                 end
  37.             end
  38.         end
  39.     end
  40.     return nearest
  41. end
  42.  
  43. local player, screenGui = Players.LocalPlayer, Instance.new("ScreenGui")
  44. screenGui.Name, screenGui.Parent = "AimbotGui", player:WaitForChild("PlayerGui")
  45. toggleButton.Name, toggleButton.Size, toggleButton.Position, toggleButton.Text, toggleButton.BackgroundTransparency, toggleButton.TextColor3, toggleButton.Parent = "ToggleButton", UDim2.new(0, 150, 0, 50), UDim2.new(0.1, 0, 0.1, 0), "ON", 1, Color3.fromRGB(0, 255, 0), screenGui
  46.  
  47. local function toggleAimbot()
  48.     isAimbotActive = not isAimbotActive
  49.     toggleButton.Text, toggleButton.TextColor3, FOVring.Visible, playerNameText.Visible = isAimbotActive and "OFF" or "ON", Color3.fromRGB(0, 255, 0), isAimbotActive, isAimbotActive
  50. end
  51.  
  52. local function updateInput(input)
  53.     local delta = input.Position - dragStart
  54.     toggleButton.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  55. end
  56.  
  57. local function onDragStart(input)
  58.     if input.UserInputType == Enum.UserInputType.MouseButton1 then
  59.         dragging, dragStart, startPos = true, input.Position, toggleButton.Position
  60.         input.Changed:Connect(function()
  61.             if input.UserInputState == Enum.UserInputState.End then
  62.                 dragging = false
  63.             end
  64.         end)
  65.     end
  66. end
  67.  
  68. local function onDrag(input)
  69.     if dragging then
  70.         updateInput(input)
  71.     end
  72. end
  73.  
  74. UserInputService.InputBegan:Connect(onDragStart)
  75. UserInputService.InputChanged:Connect(onDrag)
  76. toggleButton.MouseButton1Click:Connect(toggleAimbot)
  77.  
  78. local closeButton = Instance.new("TextButton")
  79. closeButton.Name, closeButton.Size, closeButton.Position, closeButton.Text, closeButton.TextColor3, closeButton.BackgroundTransparency, closeButton.Parent = "CloseButton", UDim2.new(0, 30, 0, 30), UDim2.new(0, toggleButton.Size.X.Offset - 15, 0, -15), "X", Color3.fromRGB(255, 255, 255), 1, toggleButton
  80.  
  81. local function closeToggleButton()
  82.     toggleButton.Visible, FOVring, playerNameText = false, FOVring:Remove(), playerNameText:Remove()
  83. end
  84.  
  85. closeButton.MouseButton1Click:Connect(closeToggleButton)
  86.  
  87. RunService.RenderStepped:Connect(function()
  88.     if isAimbotActive then
  89.         updateDrawings()
  90.         local closest = getClosestPlayerInFOV("Head")
  91.         if closest and closest.Character:FindFirstChild("Head") then
  92.             lookAt(closest.Character.Head.Position)
  93.             playerNameText.Text, playerNameText.Visible = closest.Name, true
  94.         else
  95.             playerNameText.Visible = false
  96.         end
  97.     end
  98. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement