Advertisement
Xzeni

[SB2] Fast Auto Farm

Jan 16th, 2019
921
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.80 KB | None | 0 0
  1. --[[ Settings ]]--
  2. local SpecificTargets = true -- Set true/false whether you want it to farm specific targets
  3. local Targets = { -- Keep adding mobs you want to farm. You can toggle them on/off by changing to true/false
  4.     ["Green Patrolman"] = true,
  5.     ["Patrolman Elite"] = true,
  6.     ["Centurian Defender"] = true,
  7. }
  8. local MaxSeconds = 5 -- Set this to the number of seconds before moving on to the next mob (prevents from forever fighting broken/disappearing mobs)
  9. local ToggleKey = "L" -- Set which key to toggle the farm on/off
  10. local Enabled = true -- Set whether to default to on/off
  11.  
  12. --[[ Variables ]]--
  13. local Player = game.Players.LocalPlayer
  14. local UserInputService = game:GetService("UserInputService")
  15. local Mobs = game.Workspace.Mobs
  16.  
  17. --[[ Toggle ]]--
  18. UserInputService.InputBegan:Connect(function(Input, GPE)
  19.     if not GPE then
  20.         if Input.KeyCode == Enum.KeyCode[ToggleKey] then
  21.             Enabled = not Enabled
  22.             print("Toggle " ..(Enabled and "ON" or "OFF"))
  23.         end
  24.     end
  25. end)
  26.  
  27. --[[ Main Framework ]]--
  28. while wait(1) do -- Wait 1 to prevent fast inf loops while disabled
  29.     if Enabled then
  30.         for _, v in pairs(Mobs:GetChildren()) do
  31.             if SpecificTargets and Targets[v.Name] then
  32.                 if v.PrimaryPart and v:FindFirstChild("Entity") and v:FindFirstChild("Nameplate") then
  33.                     local start = tick()
  34.                     repeat
  35.                         Player.Character:SetPrimaryPartCFrame(v:GetPrimaryPartCFrame() * CFrame.new(0, 0, 3))
  36.                         Input.LeftClick()
  37.                         wait()
  38.                     until
  39.                     v.Entity.Health.Value <= 0 or (tick() - start) >= MaxSeconds or not Enabled
  40.                 end
  41.             end
  42.         end
  43.     end
  44. end
  45.  
  46. -- By Xzeni (ProtoSmasher)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement