Advertisement
Guest User

Untitled

a guest
May 16th, 2018
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.57 KB | None | 0 0
  1. --[[
  2. This script will output the number of hoops it finds once it's ready for use.
  3. Press Q while holding E to shoot or just after to activate it.
  4. range_min, range_max is the value you want your aimbot to change the shot
  5. range to. If you change this to 100, 100 you will shoot all perfects.
  6.  
  7. Written by big smawk
  8. ]]
  9.  
  10. local player = game:GetService('Players').LocalPlayer
  11. local mouse = player:GetMouse()
  12.  
  13. local range_min, range_max = 100, 100;
  14.  
  15. local playerData = player:FindFirstChild('System')
  16. local onTeam = playerData and playerData:FindFirstChild('OnTeam')
  17.  
  18. local storage = game:GetService('ReplicatedStorage')
  19. local gp = storage.gameplay
  20. local char = gp.character
  21. local val = char.value
  22.  
  23. local function find(t,i)
  24. for index, val in next, (t) do
  25. if (index == i) then
  26. return true, index, val
  27. elseif (val == i) then
  28. return true, index, val
  29. end
  30. end
  31. end
  32.  
  33. local hoops = (function()
  34. local hs = {},{};
  35.  
  36. local rec do
  37. rec = function(o)
  38. for __, child in next, (o 'GetChildren') do
  39. if string.lower(child['Name']):match('hoop') and child:FindFirstChild('Goal') then
  40. table.insert(hs, child)
  41. elseif #child('GetChildren') > 0 then
  42. rec(child)
  43. end
  44. end
  45. end
  46. end
  47.  
  48. rec(workspace)
  49.  
  50. return hs
  51. end)()
  52.  
  53. local getShoot = function()
  54. local c = player.Character or player.CharacterAdded:wait()
  55. local hrp = c:WaitForChild('HumanoidRootPart',5)
  56. if not hrp then print('No humanoid root part.') return end
  57.  
  58.  
  59. local ball;
  60. for __, obj in next, (workspace 'GetChildren') do
  61. if obj.Name:lower() == 'basketball' and obj.controller.Value == player.Name then
  62. return obj.shoot
  63. end
  64. end
  65. end
  66.  
  67. local getHoop = function()
  68. local c = player.Character or player.CharacterAdded:wait()
  69. local hrp = c:WaitForChild('HumanoidRootPart',5)
  70. if not hrp then print('No humanoid root part.') return end
  71.  
  72. local last, closest = math.huge;
  73. for __, hoop in next, (hoops) do
  74. local goal = hoop:FindFirstChild('Goal')
  75.  
  76. if goal then
  77. local dist = (hrp.Position-goal.Position).magnitude
  78. if dist < last then
  79. last = dist
  80. closest = hoop
  81. end
  82. end
  83. end
  84. return closest
  85. end
  86.  
  87. local Attack = function(shoot, hoop)
  88. if shoot and hoop then
  89. val:FireServer("shooting", true)
  90. shoot:FireServer(hoop, math.random(range_min,range_max), true)
  91. end
  92. end
  93.  
  94. mouse.KeyDown:connect(function(key)
  95. if key == "q" then
  96. local shoot = getShoot()
  97. local hoop = getHoop()
  98.  
  99. court = hoop.Parent
  100. local data = court:FindFirstChild('GameData')
  101. local teamball = data and data:FindFirstChild('TeamBall')
  102.  
  103. local h1 = court:FindFirstChild('_Hoop1')
  104. local h2 = court:FindFirstChild('_Hoop2')
  105.  
  106. if OnTeam and OnTeam.Value == 1 and h1 then
  107. Attack(shoot,h1)
  108. return
  109. elseif OnTeam and OnTeam.Value == 2 and h2 then
  110. Attack(shoot,h2)
  111. return
  112. end
  113.  
  114. if teamball and teamball.Value == 1 and h1 then
  115. Attack(shoot,h1)
  116. return
  117. elseif teamball and teamball.Value == 2 and h2 then
  118. Attack(shoot,h2)
  119. return
  120. end
  121.  
  122.  
  123. Attack(shoot,hoop)
  124. end
  125. end)
  126.  
  127. warn('Morse: ... -.-. .-. .. .--. - . .-. | -..-. -..-. | .--. .-. --- --. .-. .- -- -- . .-.')
  128. warn('Located',#hoops,'hoops.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement