HansCSia320

Proto Aimbot

May 30th, 2019
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 10.86 KB | None | 0 0
  1. --Made By Me (For Making The ESP And Finishing The Script)
  2. --Credit To: Bditt (For Making The Base Of The Aimbot)
  3. --
  4. --If you change your camera sensitivity in the Roblox Setting (Press ESC), you are basically changing how smooth the aimbot looks.
  5. --The lower the sensitivity, the more legit it looks and more work you have to do to aim.
  6. --THEY NEED TO BE VISIBLE TO LOCK ONTO THEM!
  7. --
  8. --T = Toggles aimbot.
  9. --Right Click = Locks on.
  10. --M = Toggles teamcheck.
  11. --O = Toggles visibility check.
  12. --
  13. --
  14. --Hold Right Click to lock on.
  15. --
  16. --THIS ONLY WORKS FOR PROTOSMASHER, VISENYA, ELYSIAN, Synapse, AND HEXUS
  17. --
  18. --If they are directly behind you, it will make you aim lock in the wrong direction.
  19.  
  20. local safe = setmetatable({}, {   __index = function(_, k)
  21.        return game:GetService(k)
  22.    end
  23. })
  24.  
  25. local movethemouse = mousemoverel or Input.MoveMouse --Mouse Move Function.
  26. local leftclickme = nil --Auto Shoot Key Press Thingy.
  27. local aimbotting = true -- Toggles.
  28. local autoshoot = false
  29. local teamcheck = true
  30. local visiblecheck = true
  31. _G.xaimoffset = 0 --_G.xaimoffset = -25
  32. _G.maxdistfromcross = 100
  33.  
  34. local cam = safe.Workspace.CurrentCamera -- Current Camera
  35. local lp = safe.Players.LocalPlayer -- Local Player
  36. local lpc = safe.Players.LocalPlayer.Character -- Local Player Character
  37.  
  38. local wtos = function(v) -- World To Screen
  39.    return cam:WorldToScreenPoint(v)
  40. end
  41.  
  42. local distFromCenter = function(x, y)
  43.    local vps = cam.ViewportSize -- Get ViewPortSize.
  44.    local vpsx = vps.X
  45.    local vpsy = vps.Y
  46.    local screencenterx = vpsx/2
  47.    local screencentery = vpsy/2
  48.    local xdist = (x - screencenterx) -- X Distance From Mid Screen.
  49.    local ydist = (y - screencentery) -- Y Distance From Mid Screen.
  50.    local Hypotenuse = math.sqrt(math.pow(xdist, 2) + math.pow(ydist, 2))
  51.    return Hypotenuse
  52. end
  53.  
  54. local function inlos(p, ...) -- In line of site?
  55.    return #cam:GetPartsObscuringTarget({p}, {cam, lp.Character, ...}) == 0
  56. end
  57.  
  58. local getclosestPlayer = function() -- Checks the closest player based on Hypotenuse.
  59.    local plrs, v = safe.Players:GetPlayers()
  60.    local maxdist = 75
  61.    local dist = math.huge
  62.    local plr = "none"
  63.    for i = 1, #plrs do
  64.        v = plrs[i]
  65.        if v ~= safe.Players.LocalPlayer then
  66.            if v.Character then
  67.                if v.TeamColor ~= safe.Players.LocalPlayer.TeamColor and teamcheck then
  68.                    local hpos = wtos(v.Character.Head.Position)
  69.                    local idist = distFromCenter(hpos.X, hpos.Y)
  70.                    if idist < dist and idist < _G.maxdistfromcross then
  71.                        dist = idist
  72.                        plr = v
  73.                    end
  74.                elseif not teamcheck then
  75.                    local hpos = wtos(v.Character.Head.Position)
  76.                    local idist = distFromCenter(hpos.X, hpos.Y)
  77.                    if idist < dist and idist < _G.maxdistfromcross then
  78.                        dist = idist
  79.                        plr = v
  80.                    end
  81.                end
  82.            end
  83.        end
  84.    end
  85.    return plr, dist
  86. end
  87.  
  88. local AimAt = function(x, y)
  89.    local vps = cam.ViewportSize
  90.    local vpsx = vps.X
  91.    local vpsy = vps.Y
  92.    local screencenterx = vpsx/2
  93.    local screencentery = vpsy/2
  94.    local aimspeed = 5
  95.    local aimatx
  96.    local aimaty
  97.  
  98.    if x ~= 0 then
  99.        if x > screencenterx then
  100.            aimatx = -(screencenterx - x)
  101.            aimatx = aimatx/aimspeed
  102.            if aimatx + screencenterx > screencenterx * 2 then
  103.                aimatx = 0
  104.            end
  105.        end
  106.        if x < screencenterx then
  107.            aimatx = x - screencenterx
  108.            aimatx = aimatx/aimspeed
  109.            if aimatx + screencenterx < 0 then
  110.                aimatx = 0
  111.            end
  112.        end
  113.    end
  114.  
  115.    if y ~= 0 then
  116.        if y > screencentery then
  117.            aimaty = -(screencentery - y)
  118.            aimaty = aimaty/aimspeed
  119.            if aimaty + screencentery > screencentery * 2 then
  120.                aimaty = 0
  121.            end
  122.        end
  123.        if y < screencentery then
  124.            aimaty = y - screencentery
  125.            aimaty = aimaty/aimspeed
  126.            if aimaty + screencentery < 0 then
  127.                aimaty = 0
  128.            end
  129.        end
  130.    end
  131.    return aimatx, aimaty
  132. end
  133.  
  134. local MouseTests = function()
  135.    local player = safe.Players.LocalPlayer
  136.    local mouse = player:GetMouse()
  137.    local screensizex = mouse.ViewSizeX
  138.    local screensizey = mouse.ViewSizeY
  139.    local midx = screensizex/2
  140.    local midy = screensizey/2
  141.    local mousex = mouse.X
  142.    local mousey = mouse.Y
  143.    local moveamountx = midx - mousex
  144.    local moveamounty = midy - mousey
  145.    movethemouse(moveamountx, moveamounty)
  146.    local camera = safe.Workspace.Camera
  147.    local newmousex = safe.Players.LocalPlayer:GetMouse().X
  148.    local newmousey = safe.Players.LocalPlayer:GetMouse().Y
  149.    local closestplayer = getclosestPlayer()
  150.    if player.Character.Humanoid.Health > 0 then
  151.        if closestplayer ~= "none" then
  152.            if inlos(closestplayer.Character.Head.Position, closestplayer.Character) and visiblecheck then
  153.                local closesthead = closestplayer.Character.Head
  154.                local p = camera:WorldToScreenPoint(closesthead.Position)
  155.                local xdistancetohead, ydistancetohead = AimAt(p.X + _G.xaimoffset, p.Y + 32)
  156.                movethemouse(xdistancetohead, ydistancetohead)
  157.                if autoshoot then
  158.                    movethemouse(xdistancetohead, ydistancetohead)
  159.                    wait(1)
  160.                    Input.LeftClick(MOUSE_DOWN)
  161.                    wait()
  162.                end
  163. elseif not visiblecheck then
  164. local closesthead = closestplayer.Character.Head
  165.                local p = camera:WorldToScreenPoint(closesthead.Position)
  166.                local xdistancetohead, ydistancetohead = AimAt(p.X + _G.xaimoffset, p.Y + 32)
  167.                movethemouse(xdistancetohead, ydistancetohead)
  168.            end
  169.        end
  170.    end
  171. end
  172.  
  173. game:GetService('RunService').Stepped:connect(function()
  174.    if aimbotting then
  175.    --MouseTests()
  176.    end
  177. end)
  178.  
  179.  
  180. local plr = safe.Players.LocalPlayer
  181. local mouse = plr:GetMouse()
  182. mouse.KeyDown:connect(function(key)
  183.    if key == "t" then
  184.        aimbotting = not aimbotting
  185.        print("Aimbotting: " .. tostring(aimbotting))
  186.        MouseTests()
  187.    end
  188.    if key == "o" then
  189.        visiblecheck = not visiblecheck
  190.        print("Visible Check: " .. tostring(visiblecheck))
  191.    end
  192.  
  193.    if key == "m" then
  194.        teamcheck = not teamcheck
  195.        print("Team Check: " .. tostring(teamcheck))
  196.    end
  197. end)
  198.  
  199.  
  200.  
  201. print("Pixel Aimbot Loaded!")
  202.  
  203. MB2Held = false
  204.  
  205. function onKeyPress(inputObject,gameProcessed)
  206.    if inputObject.UserInputType == Enum.UserInputType.MouseButton2 then
  207.        MB2Held = true
  208.        while MB2Held do
  209.            if aimbotting then
  210.                MouseTests()
  211.            end
  212.            wait()
  213.        end
  214.    end
  215. end
  216.  
  217. function onKeyRelease(inputObject,gameProcessed)
  218.    if inputObject.UserInputType == Enum.UserInputType.MouseButton2 then
  219.        MB2Held = false
  220.    end
  221. end
  222.  
  223. game:GetService("UserInputService").InputBegan:connect(onKeyPress)
  224. game:GetService("UserInputService").InputEnded:connect(onKeyRelease)
  225.  
  226.     trans = 0.5
  227.     --team1 = BackgroundColor3.new("Institutional white")
  228.     --team2 = BackgroundColor3.new("Really red")
  229.  
  230.     while true do  
  231.     for i,l in pairs(game:GetService("Players"):GetChildren()) do
  232.         print (game:GetService("Players").LocalPlayer.Team)
  233.         if l ~= game:GetService("Players").LocalPlayer then
  234.         for i,v in pairs(l.Character:GetChildren()) do
  235.             if v.ClassName == "MeshPart" or "Part" and v.Name ~= "HumanoidRootPart" then
  236.             --
  237.                 xd = Instance.new("SurfaceGui")
  238.                 xd.Face = Enum.NormalId.Back
  239.             xd.Parent = v
  240.             xd.AlwaysOnTop = true
  241.             Frame = Instance.new("Frame")
  242.             Frame.Parent = xd
  243.             Frame.BackgroundColor3 = Color3.new(1, 1, 1)
  244.             Frame.Size = UDim2.new(1, 0, 1, 0)
  245.             Frame.BackgroundTransparency = trans
  246.            
  247.             if l.Team ~= game:GetService("Players").LocalPlayer.Team then
  248.                 Frame.BackgroundColor3 = Color3.new(17,17 ,17)
  249.                 else Frame.BackgroundColor3 = Color3.new(0, 255, 255)
  250.  
  251.             end
  252.            
  253.             --
  254.            
  255.                 xd = Instance.new("SurfaceGui")
  256.                 xd.Face = Enum.NormalId.Bottom
  257.             xd.Parent = v
  258.             xd.AlwaysOnTop = true
  259.             Frame = Instance.new("Frame")
  260.             Frame.Parent = xd
  261.             Frame.BackgroundColor3 = Color3.new(1, 1, 1)
  262.             Frame.Size = UDim2.new(1, 0, 1, 0)
  263.             Frame.BackgroundTransparency = trans
  264.            
  265.             if l.Team ~= game:GetService("Players").LocalPlayer.Team then
  266.                 Frame.BackgroundColor3 = Color3.new(17,17 ,17)
  267.                 else Frame.BackgroundColor3 = Color3.new(0, 255, 255)
  268.  
  269.             end
  270.  
  271.             --
  272.            
  273.             xd = Instance.new("SurfaceGui")
  274.                 xd.Face = Enum.NormalId.Front
  275.             xd.Parent = v
  276.             xd.AlwaysOnTop = true
  277.             Frame = Instance.new("Frame")
  278.             Frame.Parent = xd
  279.             Frame.BackgroundColor3 = Color3.new(1, 1, 1)
  280.             Frame.Size = UDim2.new(1, 0, 1, 0)
  281.             Frame.BackgroundTransparency = trans
  282.            
  283.             if l.Team ~= game:GetService("Players").LocalPlayer.Team then
  284.                 Frame.BackgroundColor3 = Color3.new(17,17 ,17)
  285.                 else Frame.BackgroundColor3 = Color3.new(0, 255, 255)
  286.  
  287.             end
  288.            
  289.            
  290.             --
  291.            
  292.             xd = Instance.new("SurfaceGui")
  293.                 xd.Face = Enum.NormalId.Left
  294.             xd.Parent = v
  295.             xd.AlwaysOnTop = true
  296.             Frame = Instance.new("Frame")
  297.             Frame.Parent = xd
  298.             Frame.BackgroundColor3 = Color3.new(1, 1, 1)
  299.             Frame.Size = UDim2.new(1, 0, 1, 0)
  300.             Frame.BackgroundTransparency = trans
  301.            
  302.             if l.Team ~= game:GetService("Players").LocalPlayer.Team then
  303.                 Frame.BackgroundColor3 = Color3.new(17,17 ,17)
  304.                 else Frame.BackgroundColor3 = Color3.new(0, 255, 255)
  305.  
  306.             end
  307.             --
  308.            
  309.             xd = Instance.new("SurfaceGui")
  310.                 xd.Face = Enum.NormalId.Right
  311.             xd.Parent = v
  312.             xd.AlwaysOnTop = true
  313.             Frame = Instance.new("Frame")
  314.             Frame.Parent = xd
  315.             Frame.BackgroundColor3 = Color3.new(1, 1, 1)
  316.             Frame.Size = UDim2.new(1, 0, 1, 0)
  317.             Frame.BackgroundTransparency = trans
  318.            
  319.         if l.Team ~= game:GetService("Players").LocalPlayer.Team then
  320.                 Frame.BackgroundColor3 = Color3.new(17,17 ,17)
  321.                 else Frame.BackgroundColor3 = Color3.new(0, 255, 255)
  322.  
  323.             end
  324.             --
  325.            
  326.             xd = Instance.new("SurfaceGui")
  327.                 xd.Face = Enum.NormalId.Top
  328.             xd.Parent = v
  329.             xd.AlwaysOnTop = true
  330.             Frame = Instance.new("Frame")
  331.             Frame.Parent = xd
  332.             Frame.BackgroundColor3 = Color3.new(1, 1, 1)
  333.             Frame.Size = UDim2.new(1, 0, 1, 0)
  334.             Frame.BackgroundTransparency = trans
  335.            
  336.            
  337.             if l.Team ~= game:GetService("Players").LocalPlayer.Team then
  338.                 Frame.BackgroundColor3 = Color3.new(17,17 ,17)
  339.                 else Frame.BackgroundColor3 = Color3.new(0, 255, 255)
  340.  
  341.             end
  342.        
  343.            
  344.             print (v.Name)
  345.                
  346.             end
  347.         end
  348.         end
  349.         end
  350.        
  351.     wait (5)
  352.         for i,v in pairs (game:GetService("Players"):GetChildren()) do
  353.             for i,k in pairs(v.Character:GetChildren()) do
  354.             for i,l in pairs(k:GetChildren()) do
  355.             if l.ClassName == "SurfaceGui" then
  356.                 l:Remove()
  357.             end
  358.             end
  359.             end
  360.             end
  361.            
  362.         end
Add Comment
Please, Sign In to add comment