Advertisement
Guest User

Roblox Aimbot Raw

a guest
May 26th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.65 KB | None | 0 0
  1. SetCore("SendNotification",{Title="AIMBOT LOADED",Text="Press R to Turn on/off"})
  2.  
  3. local plrs = game:GetService("Players")
  4. local TeamBased = true ; local teambasedswitch = "0"
  5. local presskeytoaim = true; local aimkey = "r"
  6. local raycast = false
  7.  
  8. local espupdatetime = 5; autoesp = false
  9.  
  10.  
  11.  
  12. local lockaim = true; local lockangle = 5
  13.  
  14.  
  15.  
  16. --function findwat(folder, what)
  17. --  for i, smth in pairs(folder:GetChildren()) do
  18. --      if string.find(string.lower(tostring(smth)), string.lower(what)) then
  19. --          return smth
  20. --      end
  21. --  end
  22. --end
  23. --
  24. --local plrs = findwat(game, "Players")
  25.  
  26.  
  27.  
  28.  
  29. local Gui = Instance.new("ScreenGui")
  30. local Move = Instance.new("Frame")
  31. local Main = Instance.new("Frame")
  32. local EspStatus = Instance.new("TextLabel")
  33. local st1 = Instance.new("TextLabel")
  34. local st1_2 = Instance.new("TextLabel")
  35. local st1_3 = Instance.new("TextLabel")
  36. local Name = Instance.new("TextLabel")
  37. --Properties:
  38. Gui.Name = "Gui"
  39. Gui.Parent = plrs.LocalPlayer:WaitForChild("PlayerGui")
  40. -- Scripts:
  41.  
  42.  
  43. local plrsforaim = {}
  44.  
  45. local lplr = game:GetService("Players").LocalPlayer
  46. Move.Draggable = true
  47. Gui.ResetOnSpawn = false
  48. Gui.Name = "Chat"
  49. Gui.DisplayOrder = 999
  50.  
  51.     Gui.Parent = plrs.LocalPlayer.PlayerGui
  52.  
  53.  
  54. f = {}
  55. local espforlder
  56.  
  57. f.addesp = function()
  58.     --print("ESP ran")
  59.     if espforlder then
  60.     else
  61.         espforlder = Instance.new("Folder")
  62.         espforlder.Parent = game.Workspace.CurrentCamera
  63.     end
  64.     for i, v in pairs(espforlder:GetChildren()) do
  65.         v:Destroy()
  66.     end
  67.     for _, plr in pairs(plrs:GetChildren()) do
  68.         if plr.Character and plr.Character.Humanoid.Health > 0 and plr.Name ~= lplr.Name then
  69.             if TeamBased == true then
  70.                 if plr.Team.Name ~= plrs.LocalPlayer.Team.Name  then
  71.                     local e = espforlder:FindFirstChild(plr.Name)
  72.                     if not e then
  73.                         --print("Added esp for team based")
  74.                         local bill = Instance.new("BillboardGui", espforlder)
  75.                         bill.Name = plr.Name
  76.                         bill.AlwaysOnTop = true
  77.                         bill.Size = UDim2.new(1,0,1,0)
  78.                         bill.Adornee = plr.Character.Head
  79.                         local Frame = Instance.new('Frame',bill)
  80.                         Frame.Active = true
  81.                         Frame.BackgroundColor3 = Color3.new(0/255,255/255,0/255)
  82.                         Frame.BackgroundTransparency = 0
  83.                         Frame.BorderSizePixel = 0
  84.                         Frame.AnchorPoint = Vector2.new(.5, .5)
  85.                         Frame.Position = UDim2.new (0.5,0,0.5,0)
  86.                         Frame.Size = UDim2.new (1,0,1,0)
  87.                         Frame.Rotation = 0
  88.                         plr.Character.Humanoid.Died:Connect(function()
  89.                             bill:Destroy()
  90.                         end)
  91.                     end
  92.                 end
  93.             else
  94.                 local e = espforlder:FindFirstChild(plr.Name)
  95.                 if not e then
  96.                     --print("Added esp")
  97.                     local bill = Instance.new("BillboardGui", espforlder)
  98.                     bill.Name = plr.Name
  99.                     bill.AlwaysOnTop = true
  100.                     bill.Size = UDim2.new(1,0,1,0)
  101.                     bill.Adornee = plr.Character.Head
  102.                     local Frame = Instance.new('Frame',bill)
  103.                     Frame.Active = true
  104.                     Frame.BackgroundColor3 = Color3.new(0/255,255/255,0/255)
  105.                     Frame.BackgroundTransparency = 0
  106.                     Frame.BorderSizePixel = 0
  107.                     Frame.AnchorPoint = Vector2.new(.5, .5)
  108.                     Frame.Position = UDim2.new (0.5,0,0.5,0)
  109.                     Frame.Size = UDim2.new (1,0,1,0)
  110.                     Frame.Rotation = 0
  111.                     plr.Character.Humanoid.Died:Connect(function()
  112.                         bill:Destroy()
  113.                     end)
  114.                 end
  115.             end
  116.            
  117.            
  118.         end
  119.     end
  120. end
  121. local cam = game.Workspace.CurrentCamera
  122.  
  123. local mouse = lplr:GetMouse()
  124. local switch = false
  125. local key = "k"
  126. local aimatpart = nil
  127. mouse.KeyDown:Connect(function(a)
  128.     if a == "t" then
  129.         print("worked1")
  130.         f.addesp()
  131.     elseif a == "u" then
  132.         if raycast == true then
  133.             raycast = false
  134.         else
  135.             raycast = true
  136.         end
  137.     elseif a == "l" then
  138.         if autoesp == false then
  139.             autoesp = true
  140.         else
  141.             autoesp = false
  142.         end
  143.     end
  144.     if a == "j" then
  145.         if mouse.Target then
  146.             mouse.Target:Destroy()
  147.         end
  148.     end
  149.     if a == key then
  150.         if switch == false then
  151.             switch = true
  152.         else
  153.             switch = false
  154.             if aimatpart ~= nil then
  155.                 aimatpart = nil
  156.             end
  157.         end
  158.     elseif a == teambasedswitch then
  159.         if TeamBased == true then
  160.             TeamBased = false
  161.             teambasedstatus.Text = tostring(TeamBased)
  162.         else
  163.             TeamBased = true
  164.             teambasedstatus.Text = tostring(TeamBased)
  165.         end
  166.     elseif a == aimkey then
  167.         if not aimatpart then
  168.             local maxangle = math.rad(20)
  169.             for i, plr in pairs(plrs:GetChildren()) do
  170.                 if plr.Name ~= lplr.Name and plr.Character and plr.Character.Head and plr.Character.Humanoid and plr.Character.Humanoid.Health > 1 then
  171.                     if TeamBased == true then
  172.                         if plr.Team.Name ~= lplr.Team.Name then
  173.                             local an = checkfov(plr.Character.Head)
  174.                             if an < maxangle then
  175.                                 maxangle = an
  176.                                 aimatpart = plr.Character.Head
  177.                             end
  178.                         end
  179.                     else
  180.                         local an = checkfov(plr.Character.Head)
  181.                             if an < maxangle then
  182.                                 maxangle = an
  183.                                 aimatpart = plr.Character.Head
  184.                             end
  185.                             print(plr)
  186.                     end
  187.                     plr.Character.Humanoid.Died:Connect(function()
  188.                         if aimatpart.Parent == plr.Character or aimatpart == nil then
  189.                             aimatpart = nil
  190.                         end
  191.                     end)
  192.                 end
  193.             end
  194.         else
  195.             aimatpart = nil
  196.         end
  197.     end
  198. end)
  199.  
  200. function getfovxyz (p0, p1, deg)
  201.     local x1, y1, z1 = p0:ToOrientation()
  202.     local cf = CFrame.new(p0.p, p1.p)
  203.     local x2, y2, z2 = cf:ToOrientation()
  204.     --local d = math.deg
  205.     if deg then
  206.         --return Vector3.new(d(x1-x2), d(y1-y2), d(z1-z2))
  207.     else
  208.         return Vector3.new((x1-x2), (y1-y2), (z1-z2))
  209.     end
  210. end
  211.  
  212. function getaimbotplrs()
  213.     plrsforaim = {}
  214.     for i, plr in pairs(plrs:GetChildren()) do
  215.         if plr.Character and plr.Character.Humanoid and plr.Character.Humanoid.Health > 0 and plr.Name ~= lplr.Name and plr.Character.Head then
  216.            
  217.             if TeamBased == true then
  218.                 if plr.Team.Name ~= lplr.Team.Name then
  219.                     local cf = CFrame.new(game.Workspace.CurrentCamera.CFrame.p, plr.Character.Head.CFrame.p)
  220.                     local r = Ray.new(cf, cf.LookVector * 10000)
  221.                     local ign = {}
  222.                     for i, v in pairs(plrs.LocalPlayer.Character:GetChildren()) do
  223.                         if v:IsA("BasePart") then
  224.                             table.insert(ign , v)
  225.                         end
  226.                     end
  227.                     local obj = game.Workspace:FindPartOnRayWithIgnoreList(r, ign)
  228.                     if obj.Parent == plr.Character and obj.Parent ~= lplr.Character then
  229.                         table.insert(plrsforaim, obj)
  230.                     end
  231.                 end
  232.             else
  233.                 local cf = CFrame.new(game.Workspace.CurrentCamera.CFrame.p, plr.Character.Head.CFrame.p)
  234.                 local r = Ray.new(cf, cf.LookVector * 10000)
  235.                 local ign = {}
  236.                 for i, v in pairs(plrs.LocalPlayer.Character:GetChildren()) do
  237.                     if v:IsA("BasePart") then
  238.                         table.insert(ign , v)
  239.                     end
  240.                 end
  241.                 local obj = game.Workspace:FindPartOnRayWithIgnoreList(r, ign)
  242.                 if obj.Parent == plr.Character and obj.Parent ~= lplr.Character then
  243.                     table.insert(plrsforaim, obj)
  244.                 end
  245.             end
  246.            
  247.            
  248.         end
  249.     end
  250. end
  251.  
  252. function aimat(part)
  253.     cam.CFrame = CFrame.new(cam.CFrame.p, part.CFrame.p)
  254. end
  255. function checkfov (part)
  256.     local fov = getfovxyz(game.Workspace.CurrentCamera.CFrame, part.CFrame)
  257.     local angle = math.abs(fov.X) + math.abs(fov.Y)
  258.     return angle
  259. end
  260.  
  261. game:GetService("RunService").RenderStepped:Connect(function()
  262.     if aimatpart then
  263.         aimat(aimatpart)
  264.         if aimatpart.Parent == plrs.LocalPlayer.Character then
  265.             aimatpart = nil
  266.         end
  267.     end
  268.    
  269.    
  270. --  if switch == true then
  271. --      local maxangle = 99999
  272. --      
  273. --      --print("Loop")
  274. --      if true and raycast == false then
  275. --          for i, plr in pairs(plrs:GetChildren()) do
  276. --              if plr.Name ~= lplr.Name and plr.Character and plr.Character.Head and plr.Character.Humanoid and plr.Character.Humanoid.Health > 1 then
  277. --                  if TeamBased then
  278. --                      if plr.Team.Name ~= lplr.Team.Name or plr.Team.TeamColor ~= lplr.Team.TeamColor then
  279. --                          local an = checkfov(plr.Character.Head)
  280. --                          if an < maxangle then
  281. --                              maxangle = an
  282. --                              aimatpart = plr.Character.Head
  283. --                              if an < lockangle then
  284. --                                  break
  285. --                              end
  286. --                          end
  287. --                      end
  288. --                  else
  289. --                      local an = checkfov(plr.Character.Head)
  290. --                          if an < maxangle then
  291. --                              maxangle = an
  292. --                              aimatpart = plr.Character.Head
  293. --                              if an < lockangle then
  294. --                                  break
  295. --                              end
  296. --                          end
  297. --                  end
  298. --                  
  299. --                  
  300. --                  
  301. --                  
  302. --              end
  303. --          end
  304. --      elseif raycast == true then
  305. --          
  306. --      end
  307.        
  308.         if raycast == true and switch == false and not aimatpart then
  309.             getaimbotplrs()
  310.             aimatpart = nil
  311.             local maxangle = 999
  312.             for i, v in ipairs(plrsforaim) do
  313.                 if v.Parent ~= lplr.Character then
  314.                     local an = checkfov(v)
  315.                     if an < maxangle and v ~= lplr.Character.Head then
  316.                         maxangle = an
  317.                         aimatpart = v
  318.                         print(v:GetFullName())
  319.                         v.Parent.Humanoid.Died:connect(function()
  320.                             aimatpart = nil
  321.                         end)
  322.                     end
  323.                 end
  324.             end
  325.        
  326.     end
  327. end)
  328. delay(0, function()
  329.     while wait(espupdatetime) do
  330.         if autoesp == true then
  331.             pcall(function()
  332.             f.addesp()
  333.             end)
  334.         end
  335.     end
  336. end)
  337. warn("loaded")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement