Advertisement
ProScripter29

Universal Sword Autofarm V3

May 27th, 2025 (edited)
457
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.04 KB | None | 0 0
  1. -- This is experimental and should perform better than V2
  2.  
  3. local Players = game:GetService("Players")
  4.  
  5. local LPlayer = Players.LocalPlayer
  6.  
  7. local RunService = game:GetService("RunService")
  8.  
  9. --_G.Range = 10
  10. --_G.Whitelist = {}
  11. --_G.Blacklist = {}
  12. --_G.TeamCheck = false
  13. --_G.SwordAutoEnabled = true
  14.  
  15. local function CheckPlayer(Player)
  16.     if Player and Player.Character and LPlayer and LPlayer.Character then
  17.         local Char = Player.Character
  18.         local Root = Char:FindFirstChild("HumanoidRootPart")
  19.         local Humanoid = Char:FindFirstChild("Humanoid")
  20.         if Root and Humanoid and Humanoid.Health > 0 then
  21.             if (LPlayer.Character.HumanoidRootPart.Position - Root.Position).Magnitude <= _G.Range then -- RANGE
  22.                 -- Custom Parameters
  23.                 if (#_G.Blacklist == 0) and (#_G.Whitelist > 0) then -- If WHITELIST
  24.                     for i, Whitelist in pairs(_G.Whitelist) do
  25.                         if Player.Name == Whitelist or Player.DisplayName == Whitelist then
  26.                             return
  27.                         end
  28.                     end
  29.                 elseif (#_G.Blacklist) > 0 and (_G.Whitelist == 0) then -- If BLACKLIST
  30.                     for i, Blacklist in pairs(_G.Blacklist) do
  31.                         if Player.Name == Blacklist or Player.DisplayName == Blacklist then
  32.                             return true
  33.                         else
  34.                             return
  35.                         end
  36.                     end
  37.                 end
  38.                 if (_G.TeamCheck == true) and not(LPlayer.Team == nil) and (LPlayer.Team == Player.Team) then -- Team CHECK
  39.                     return
  40.                 end
  41.                 return true
  42.             end
  43.         end
  44.     end
  45. end
  46.  
  47. local RunSetting = RunService.RenderStepped:Connect(function()
  48.     if _G.SwordAutoEnabled then
  49.         for i, Player in pairs(game.Players:GetPlayers()) do
  50.             local Check = CheckPlayer(Player)
  51.             if Check then
  52.                 local Character = Player.Character
  53.                 local Sword = LPlayer.Character:FindFirstChildOfClass("Tool")
  54.                 if Sword and Sword:FindFirstChild("Handle") then
  55.                     Sword:Activate()
  56.                     firetouchinterest(Sword.Handle, Character.HumanoidRootPart, 0)
  57.                     firetouchinterest(Sword.Handle, Character.HumanoidRootPart, 1)
  58.                 end
  59.             end
  60.         end
  61.     end
  62. end)
  63.  
  64. repeat
  65.     task.wait()
  66. until _G.SwordAutoEnabled == false
  67.  
  68. RunSetting:Disconnect()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement