Advertisement
Vzurxy

collection of 2 silent-aims

Nov 12th, 2019
462
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.00 KB | None | 0 0
  1. arsenal
  2.  
  3. local localPlayer = game:GetService("Players").LocalPlayer
  4. local currentCamera = game:GetService("Workspace").CurrentCamera
  5. local mouse = localPlayer:GetMouse()
  6. local teamCheck = true
  7.  
  8. function getClosestPlayerToCursor() [nonamecall]
  9.     local closestPlayer = nil
  10.     local shortestDistance = math.huge
  11.    
  12.     for i, v in pairs(game:GetService("Players"):GetPlayers()) do
  13.         if v.Name ~= localPlayer.Name then
  14.             if v.Character and v.Character:FindFirstChild("Humanoid") and v.Character.Humanoid.Health ~= 0 and v.Character:FindFirstChild("HumanoidRootPart") and v.Character:FindFirstChild("Head") and teamCheck and v.Team ~= localPlayer.Team then
  15.                 local pos = currentCamera:WorldToViewportPoint(v.Character.HumanoidRootPart.Position)
  16.                 local magnitude = (Vector2.new(pos.X, pos.Y) - Vector2.new(mouse.X, mouse.Y)).magnitude
  17.  
  18.                 if magnitude < shortestDistance then
  19.                     closestPlayer = v
  20.                     shortestDistance = magnitude
  21.                 end
  22.             elseif v.Character and v.Character:FindFirstChild("Humanoid") and v.Character.Humanoid.Health ~= 0 and v.Character:FindFirstChild("HumanoidRootPart") and v.Character:FindFirstChild("Head") and not teamCheck then
  23.                 local pos = currentCamera:WorldToViewportPoint(v.Character.HumanoidRootPart.Position)
  24.                 local magnitude = (Vector2.new(pos.X, pos.Y) - Vector2.new(mouse.X, mouse.Y)).magnitude
  25.  
  26.                 if magnitude < shortestDistance then
  27.                     closestPlayer = v
  28.                     shortestDistance = magnitude
  29.                 end
  30.             end
  31.         end
  32.     end
  33.    
  34.     return closestPlayer or localPlayer
  35. end
  36.  
  37. game:GetService("UserInputService").InputBegan:Connect(function(input, onGui)
  38.     if not onGui and input.KeyCode == Enum.KeyCode.T then
  39.         teamCheck = not teamCheck
  40.     end
  41. end)
  42.  
  43. local mt = getrawmetatable(game)
  44. local oldNamecall = mt.__namecall
  45. if setreadonly then setreadonly(mt, false) else make_writeable(mt, true) end
  46. local namecallMethod = getnamecallmethod or get_namecall_method
  47. local newClose = newcclosure or function(f) return f end
  48.  
  49. mt.__namecall = newClose(function(...) [nonamecall]
  50.     local method = namecallMethod()
  51.     local args = {...}
  52.  
  53.     if tostring(method) == "FireServer" and tostring(args[1]) == "HitPart" then
  54.         args[2] = getClosestPlayerToCursor().Character.Head
  55.         args[3] = getClosestPlayerToCursor().Character.Head.Position
  56.  
  57.         return oldNamecall(unpack(args))
  58.     end
  59.  
  60.     return oldNamecall(...)
  61. end)
  62.  
  63. if setreadonly then setreadonly(mt, true) else make_writeable(mt, false) end
  64.  
  65.  
  66. [=]
  67.  
  68. sa
  69.  
  70. local localPlayer = game:GetService("Players").LocalPlayer
  71. local currentCamera = game:GetService("Workspace").CurrentCamera
  72. local mouse = localPlayer:GetMouse()
  73. local teamCheck = true
  74.  
  75. local function getClosestPlayerToCursor()
  76.     local closestPlayer = nil
  77.     local shortestDistance = math.huge
  78.    
  79.     for i, v in pairs(game:GetService("Players"):GetPlayers()) do
  80.         if v.Name ~= localPlayer.Name then
  81.             if v.Character and v.Character:FindFirstChild("Humanoid") and v.Character.Humanoid.Health ~= 0 and v.Character:FindFirstChild("HumanoidRootPart") and v.Character:FindFirstChild("Head") and teamCheck and v.Team ~= localPlayer.Team then
  82.                 local pos = currentCamera:WorldToViewportPoint(v.Character.HumanoidRootPart.Position)
  83.                 local magnitude = (Vector2.new(pos.X, pos.Y) - Vector2.new(mouse.X, mouse.Y)).magnitude
  84.  
  85.                 if magnitude < shortestDistance then
  86.                     closestPlayer = v
  87.                     shortestDistance = magnitude
  88.                 end
  89.             elseif v.Character and v.Character:FindFirstChild("Humanoid") and v.Character.Humanoid.Health ~= 0 and v.Character:FindFirstChild("HumanoidRootPart") and v.Character:FindFirstChild("Head") and not teamCheck then
  90.                 local pos = currentCamera:WorldToViewportPoint(v.Character.HumanoidRootPart.Position)
  91.                 local magnitude = (Vector2.new(pos.X, pos.Y) - Vector2.new(mouse.X, mouse.Y)).magnitude
  92.  
  93.                 if magnitude < shortestDistance then
  94.                     closestPlayer = v
  95.                     shortestDistance = magnitude
  96.                 end
  97.             end
  98.         end
  99.     end
  100.    
  101.     return closestPlayer
  102. end
  103.  
  104. game:GetService("UserInputService").InputBegan:Connect(function(input, onGui)
  105.     if not onGui and input.KeyCode == Enum.KeyCode.T then
  106.         teamCheck = not teamCheck
  107.     end
  108. end)
  109.  
  110. local mt = getrawmetatable(game)
  111. local oldIndex = mt.__index
  112. local oldNamecall = mt.__namecall
  113. if setreadonly then setreadonly(mt, false) else make_writeable(mt, true) end
  114. local nameCallMethod = getnamecallmethod or get_namecall_method
  115. local newClose = newcclosure or function(f) return f end
  116.  
  117. mt.__index = newClose(function(t, k)
  118.     if t == mouse and tostring(k) == "Hit" and getClosestPlayerToCursor() and getClosestPlayerToCursor().Character:FindFirstChild("Head") then
  119.         return getClosestPlayerToCursor().Character.Head.CFrame
  120.     end
  121.  
  122.     return oldIndex(t, k)
  123. end)
  124.  
  125. mt.__namecall = newClose(function(...)
  126.     local method = nameCallMethod()
  127.     local args = {...}
  128.  
  129.     if tostring(method) == "FindPartOnRayWithIgnoreList" and getClosestPlayerToCursor() and getClosestPlayerToCursor().Character then
  130.         return oldNamecall(args[1], args[2], {game:GetService("Workspace").IgnoreThese, game:GetService("Players").LocalPlayer.Character, game:GetService("Workspace").BuildStuff, game:GetService("Workspace").Map})
  131.     end
  132.  
  133.     return oldNamecall(...)
  134. end)
  135.  
  136. if setreadonly then setreadonly(mt, true) else make_writeable(mt, false) end
  137.  
  138. local oldFunc
  139.  
  140. oldFunc = hookfunction(workspace.FindPartOnRayWithIgnoreList, function(...)
  141.     local args = {...}
  142.  
  143.     args[3] = {game:GetService("Workspace").IgnoreThese, game:GetService("Players").LocalPlayer.Character, game:GetService("Workspace").BuildStuff, game:GetService("Workspace").Map}
  144.  
  145.     return oldFunc(unpack(args))
  146. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement