Advertisement
XZTablets

XZBan

Mar 30th, 2020
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.78 KB | None | 0 0
  1. local flat_ui_lib = loadstring(game:HttpGet("https://pastebin.com/raw/stikyhSj"))()
  2.  
  3. local new_ui = flat_ui_lib:Create(false, "XZBan", "Q")
  4.  
  5. local auto = new_ui:AddOption("Auto")
  6.  
  7. local player = game.Players.LocalPlayer
  8. local character = player.Character
  9. local humanoid = character:WaitForChild("Humanoid")
  10.  
  11. local backpack = player.Backpack
  12.  
  13. local data = player.data
  14. local current_weapon = data.currentWeapon
  15.  
  16. humanoid:UnequipTools()
  17.  
  18. local tool = backpack:FindFirstChild(current_weapon.Value)
  19. local damage_event = tool:FindFirstChild("Damage")
  20.  
  21. humanoid:EquipTool(tool)
  22.  
  23. local npcs_folder = game.Workspace.Zones.npcSpawn
  24.  
  25. local npcs = {}
  26. local npc_options = {}
  27.  
  28. for i,v in pairs(npcs_folder:GetChildren()) do
  29.     if not npcs[v.Name] then
  30.         npcs[v.Name] = v.Name
  31.         table.insert(npc_options, v.Name)
  32.     end
  33. end
  34.  
  35. local target = "New_Item"
  36.  
  37. local new_target = npcs_folder:FindFirstChild(target)
  38. local target_alive = true
  39.  
  40. local auto_farm = false
  41.  
  42. auto:AddToggle("Auto Farm", false, function(returned)
  43.     auto_farm = returned
  44. end)
  45.  
  46. auto:AddDropdown("Select Target", npc_options, function(returned)
  47.     target = returned
  48. end)
  49.  
  50. npcs_folder.ChildRemoved:Connect(function(child)
  51.     if child == new_target then
  52.         target_alive = false
  53.         humanoid:UnequipTools()
  54.         local best_tool = backpack:FindFirstChild(current_weapon.Value)
  55.         wait()
  56.         humanoid:EquipTool(best_tool)
  57.     end
  58. end)
  59.  
  60. spawn(function()
  61.     while wait() do
  62.         if auto_farm then
  63.             if new_target and target_alive then
  64.                 character.HumanoidRootPart.CFrame = (new_target.PrimaryPart.CFrame + new_target.PrimaryPart.CFrame.LookVector * -0.2) * CFrame.new(-1.5, 0, 1.5)
  65.                 damage_event:FireServer(new_target, tool.Name)
  66.             else
  67.                 new_target = npcs_folder:FindFirstChild(target)
  68.                 target_alive = true
  69.             end
  70.         end
  71.     end
  72. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement