Flamefled

Untitled

Jan 6th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. _G.range = math.huge
  2. _G.loop = false
  3. _G.teleportbypass = true
  4.  
  5. local lp = game.Players.LocalPlayer
  6. local rs = game:GetService("RunService").RenderStepped
  7. local uis = game:GetService("UserInputService").InputBegan
  8. local pfs = game:GetService("PathfindingService")
  9.  
  10. local scanning = false
  11. local closest, enemy = math.huge, nil
  12.  
  13. function attack(entity)
  14. if entity then
  15. if lp.Character:FindFirstChild("HumanoidRootPart") and entity:FindFirstChild("HumanoidRootPart") then
  16. rs:wait()
  17.  
  18. if _G.teleportbypass and (enemy.HumanoidRootPart.Position-lp.Character.HumanoidRootPart.Position).magnitude > 10 then
  19. local path = pfs:FindPathAsync(lp.Character.HumanoidRootPart.Position, entity.HumanoidRootPart.Position)
  20. local points = path:GetWaypoints()
  21.  
  22. for _,v in pairs(points) do
  23. rs:wait()
  24.  
  25. lp.Character.HumanoidRootPart.CFrame = CFrame.new(v.Position)
  26. end
  27.  
  28. else
  29. lp.Character.HumanoidRootPart.CFrame = entity.HumanoidRootPart.CFrame
  30. end
  31.  
  32. mouse1click()
  33. end
  34. end
  35. end
  36.  
  37. function scan()
  38. if not scanning then
  39. closest = math.huge
  40. enemy = nil
  41. scanning = true
  42. for _,v in pairs(game.Workspace.Mobs:GetChildren()) do
  43. if v:FindFirstChild("HumanoidRootPart") then
  44.  
  45. local mag = (v.HumanoidRootPart.Position-lp.Character.HumanoidRootPart.Position).magnitude
  46. if mag <= _G.range and v.Entity.Health.Value > 0 and mag <= closest then
  47. closest = mag
  48. enemy = v
  49. end
  50. end
  51. end
  52.  
  53. repeat attack(enemy) until enemy.Entity.Health.Value <= 0 or not enemy or not enemy:FindFirstChild("HumanoidRootPart")
  54.  
  55. scanning = false
  56.  
  57. if _G.loop then
  58. scan()
  59. end
  60. end
  61. end
  62.  
  63. uis:connect(function(key)
  64. if key.KeyCode == Enum.KeyCode.T then
  65.  
  66. spawn(function()
  67. if _G.loop then
  68. _G.loop = false
  69.  
  70. else
  71. _G.loop = true
  72. end
  73. end)
  74.  
  75. scan()
  76.  
  77. elseif key.KeyCode == Enum.KeyCode.Y then
  78. scan()
  79.  
  80. elseif key.KeyCode == Enum.KeyCode.U then
  81. spawn(function()
  82. if _G.teleportbypass then
  83. _G.teleportbypass = false
  84.  
  85. else
  86. _G.teleportbypass = true
  87. end
  88. end)
  89. end
  90. end)
Advertisement
Add Comment
Please, Sign In to add comment