SHARE
TWEET

TEST

SoDeep Dec 7th, 2019 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local IgnorePlayersNamed = {NAME=true} -- Name = true or false
  2. --[[
  3.     [J] - To go down the list.
  4.     [U] - To go up the list.
  5.     [K] - To toggle that item in the list.
  6.     [RMB] - To aim at your target using the current settings. (THIS UPDATES IN LIVE TIME SO YOU DON'T HAVE TO STOP AIMING FOR IT TO TAKE EFFECT)
  7. --]]
  8.  
  9. local services  = setmetatable({
  10.         World   = game:GetService('Workspace');
  11.         Players = game:GetService('Players');
  12.         Input   = game:GetService('UserInputService');
  13.         Run     = game:GetService('RunService');
  14.         UI      = game:GetService('StarterGui');
  15.     },{
  16.     __index                 = function(tab,index)
  17.         local serv
  18.         local ran,err       = pcall(function() serv=game:service(index) end)
  19.         if ran then
  20.             tab[index]      = serv
  21.             return serv
  22.         end
  23.     end
  24. })
  25.  
  26. local cre = function(class,parent)
  27.     local create = LoadLibrary('RbxUtility').Create
  28.     return function(props)
  29.         local inst = create(class)(props)
  30.         inst.Parent = parent
  31.        
  32.         return inst
  33.     end
  34. end
  35.  
  36. local ResizeUI = function(ui,downscale,byclass)
  37.     if not rawequal(ui['ClassName'],'ScrollingFrame') then print('This was mean\'t for scrolling frames.') return end
  38.    
  39.     local count = 0;  
  40.     for __, asset in next, (ui:GetChildren()) do
  41.         if rawequal(asset['ClassName'],byclass) then
  42.             count = count + 1
  43.         end
  44.     end
  45.    
  46.     ui['CanvasSize'] = UDim2.new(ui.CanvasSize.X.Scale,ui.CanvasSize.X.Offset,ui.CanvasSize.Y.Scale,downscale*count)
  47. end
  48.  
  49. local wfc, ffc, ffoc, cast, ray = services.World.WaitForChild, services.World.FindFirstChild, services.World.FindFirstChildOfClass, services.World.FindPartOnRayWithIgnoreList, Ray.new
  50. local wfcoc = function(p,class)
  51.     local obj
  52.     repeat services.Run.RenderStepped:wait()
  53.         obj = p:FindFirstChildOfClass(class)
  54.     until obj
  55.     return obj
  56. end
  57.  
  58. local Client = services.Players.LocalPlayer
  59. local ClientUI = wfc(Client,'PlayerGui')
  60. local ClientMouse = Client:GetMouse()
  61. local ClientModel = Client.Character or Client.CharacterAdded:wait()
  62. local ClientCamera = services.World.CurrentCamera
  63. local ClientHumanoid = wfcoc(ClientModel,'Humanoid')
  64. local ClientActiveUI;
  65.  
  66. local status = {
  67.     Enabled = false,
  68.     TeamCheck = false,
  69.     HeadsOnly = false,
  70.     RayCheck = true,
  71.     AutoAim = false,
  72. }
  73.  
  74. local function toggle(button)
  75.     local option, val = button['Text']:match('(.*):%s*(.*)')
  76.     status[option] = not status[option]
  77.    
  78.     if status[option] then
  79.         button.TextColor3 = Color3.fromRGB(0,255,0)
  80.     else
  81.         button.TextColor3 = Color3.fromRGB(255,0,0)
  82.     end
  83.     button.Text = option .. ': ' .. tostring(status[option])
  84. end
  85.  
  86. local selection = {}
  87. local select_pos = 1
  88. local current_pos = 0
  89. local __ = function()
  90.     if ffc(game.CoreGui, '___') then return end
  91.    
  92.     local GUI = cre('ScreenGui',game:GetService('CoreGui')){
  93.         Name = '___';
  94.     }
  95.    
  96.     local Frame = cre('ScrollingFrame',GUI){
  97.         BackgroundTransparency = 1,
  98.         BorderSizePixel = 0,
  99.        
  100.         Name = 'Options',
  101.         Position = UDim2.new(.8,0,.915,0),
  102.         Size = UDim2.new(.2,0,0,30),
  103.         ZIndex = 10,
  104.         ClipsDescendants = true,
  105.         CanvasSize = UDim2.new(0,0,0,0),
  106.         ScrollBarThickness = 0,
  107.         ScrollingEnabled = false,
  108.     }
  109.    
  110.     local UILL = cre('UIListLayout',Frame){
  111.         Name = 'LayoutHandler',
  112.         FillDirection = 'Vertical',
  113.         HorizontalAlignment = 'Center',
  114.         SortOrder = 'LayoutOrder',
  115.         VerticalAlignment = 'Top'
  116.     }
  117.    
  118.     local Template = cre('TextButton',nil){
  119.         BackgroundTransparency = 1,
  120.         BorderSizePixel = 0,
  121.        
  122.         Name = 'Template',
  123.         Size = UDim2.new(.9,0,0,30),
  124.         Font = 'SciFi',
  125.         Text = '',
  126.         TextColor3 = Color3.fromRGB(255,255,255),
  127.         TextScaled = true,
  128.         TextWrapped = true,
  129.     }
  130.    
  131.     local TSC = cre('UISizeConstraint',Template){
  132.         Name = 'TemplateSizeConstraint',      
  133.         MaxSize = Vector2.new(math.huge,30),
  134.     }
  135.    
  136.     Frame['ChildAdded']:connect(function()
  137.         ResizeUI(Frame,30,'TextButton')
  138.     end)
  139.    
  140.     local sel_pos = 0
  141.     for option, val in next, status do
  142.         local tp = Template:Clone()
  143.        
  144.         tp.Name = option
  145.         tp.Text = option .. ': ' .. tostring(val)
  146.        
  147.         if status[option] then
  148.             tp.TextColor3 = Color3.fromRGB(0,255,0)
  149.         else
  150.             tp.TextColor3 = Color3.fromRGB(255,0,0)
  151.         end
  152.        
  153.         sel_pos = sel_pos + 1
  154.         selection[sel_pos] = tp    
  155.         tp.Parent = Frame
  156.     end
  157.  
  158.     Frame.CanvasPosition = Vector2.new(0, current_pos)
  159.     return Frame
  160. end
  161.  
  162. Client['CharacterAdded']:connect(function(c)
  163.     ClientModel = c
  164.     ClientHumanoid = wfcoc(ClientModel,'Humanoid')
  165.     ClientActiveUI.Parent.Parent = nil
  166.     ClientActiveUI = coroutine.wrap(__)()
  167. end)
  168. ClientActiveUI = coroutine.wrap(__)()
  169.  
  170. local right_down, keylogs, inputlogs = nil, {}, {}
  171. services.Input.InputBegan:connect(function(input, procc)
  172.     keylogs[input.KeyCode],inputlogs[input.UserInputType] = true, true;
  173.    
  174.     if not ClientActiveUI then return end
  175.     if keylogs[Enum.KeyCode.U] and current_pos >= 30 then
  176.         select_pos = select_pos - 1
  177.         current_pos = current_pos - 30
  178.         ClientActiveUI.CanvasPosition = Vector2.new(0,current_pos)
  179.        
  180.     elseif keylogs[Enum.KeyCode.J] and current_pos < ClientActiveUI.CanvasSize.Y.Offset - 30 then
  181.         select_pos = select_pos + 1    
  182.         current_pos = current_pos + 30    
  183.         ClientActiveUI.CanvasPosition = Vector2.new(0,current_pos)
  184.        
  185.     elseif keylogs[Enum.KeyCode.K] then
  186.         if selection[select_pos] then
  187.             toggle(selection[select_pos])
  188.         end
  189.     end
  190. end)
  191. services.Input.InputEnded:connect(function(input, procc)
  192.     keylogs[input.KeyCode],inputlogs[input.UserInputType] = false, false;
  193. end)
  194.  
  195. local function GetPlayerFromCharacter(mod)
  196.     if not mod:IsA('Model') then return end
  197.    
  198.     for __, client in next, services.Players:GetPlayers() do
  199.         if rawequal(string.lower(client['Name']):sub(1,#mod['Name']),mod['Name']:lower()) then
  200.             return client, client['Name']
  201.         end
  202.     end    
  203.     return nil, 'N/A'
  204. end
  205.  
  206. local function Search()
  207.     local t = {}  
  208.     for __, child in next, services.World:GetChildren() do
  209.         local UserFromCharacter = GetPlayerFromCharacter(child)
  210.         if UserFromCharacter then
  211.             if child:IsA('Model') and not rawequal(UserFromCharacter,Client) then
  212.                 local h = ffoc(child,'Humanoid')
  213.                 if h and h.Health > 0 then
  214.                     table.insert(t, {child,UserFromCharacter})
  215.                 end
  216.             end
  217.         end
  218.     end
  219.     return t
  220. end
  221.  
  222. local function cast_ray(p0,p1,blacklist)
  223.     local Part
  224.     local __=0
  225.     repeat
  226.         __=__+1
  227.         local cond=(p1-p0).magnitude < 999
  228.         Part,p0=cast(workspace,ray(p0,cond and p1-p0 or (p1-p0).unit*999),blacklist)
  229.         if Part then
  230.             if Part.CanCollide==false or Part.Transparency==1 then
  231.                 blacklist[#blacklist+1]=Part
  232.                 Part=nil
  233.             end
  234.         elseif cond or __ > 15 then
  235.             break
  236.         end
  237.     until Part
  238.     return Part,p0
  239. end
  240.  
  241. services.Run.RenderStepped:connect(function()
  242.     local Storage = {}
  243.     if status['Enabled'] and (inputlogs[Enum.UserInputType.MouseButton2] or status['AutoAim']) then
  244.         Storage = Search()
  245.        
  246.         local dot, face = -1
  247.         for __, info in next, (Storage) do
  248.             local h = ffc(info[1],'Humanoid')
  249.             local skip;
  250.            
  251.             if not inputlogs[Enum.UserInputType.MouseButton2] and not status['AutoAim'] then return end
  252.             if not info[1] or not info[2] or IgnorePlayersNamed[info[2]['Name']] or ffoc(info[1],'ForceField') then skip = true end
  253.             if not ffc(info[1],'HumanoidRootPart') then skip = true end
  254.                    
  255.             if h and h['Health'] > 0 then
  256.                 if status['TeamCheck'] then
  257.                     if Client['TeamColor'] == info[2]['TeamColor'] then
  258.                         skip = true
  259.                     end
  260.                 end
  261.                
  262.                 if not skip then
  263.                     local cc = ClientCamera.CFrame
  264.                     local pos = status['HeadsOnly'] and info[1]['HumanoidRootPart'].CFrame.p + Vector3.new(0,1.5,0) or info[1]['HumanoidRootPart'].Position
  265.                     local HitPart=cast_ray(cc.p,pos,{ClientCamera,ClientModel})
  266.                    
  267.                     if not (status['RayCheck'] and HitPart) or info[1]:IsAncestorOf(HitPart) then
  268.                         local m = (pos-cc.p).unit:Dot(cc.lookVector)
  269.                         if rawequal(m,m) and m > dot then
  270.                             dot, face= m, pos
  271.                         end
  272.                     end
  273.                 end
  274.             end
  275.         end
  276.         if face then
  277.             ClientCamera.CFrame = CFrame.new(ClientCamera.CFrame.p,face) * CFrame.new(0,0,0.5)
  278.         end
  279.     end
  280. end)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top