Advertisement
Guest User

RB WORLD 2 AIMBOT

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