SHARE
TWEET

Untitled

a guest Mar 26th, 2020 152 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. _G.autofarm = false
  2. game:GetService("StarterGui"):SetCore("ResetButtonCallback", true)
  3. while _G.autofarm == true do
  4.     local players = game:service'Players';
  5.     local tweenService = game:service'TweenService';
  6.     local runService = game:service'RunService';
  7.     local replicatedStorage = game:service'ReplicatedStorage';
  8.     local virtualUser = game:service'VirtualUser';
  9.     local camera = workspace.CurrentCamera
  10.     local player = players.LocalPlayer;
  11.     local playerGui = player.PlayerGui;
  12.     local vec3New = Vector3.new;
  13.     local vec2New = Vector2.new;
  14.     local cframeNew = CFrame.new;
  15.     local tweenInfoNew = TweenInfo.new;
  16.     local constVec = vec3New(0, 5, 0);
  17.     local constVec2 = vec2New(0, 0);
  18.     local mouse = player:GetMouse();
  19.    
  20.     local equipRemote = replicatedStorage.Remotes.E;
  21.    
  22.     local function equip()
  23.         if player.Character:WaitForChild('Humanoid').Equip.Value then return end;
  24.         local headBillGui = player.Character.Head:FindFirstChild("HeadBillGui");
  25.         if headBillGui then
  26.             headBillGui:Destroy();
  27.         end
  28.         equipRemote:FireServer(true);
  29.         wait(1.1);
  30.     end
  31.    
  32.     local function getNearestMob()
  33.         local nearestM, nearest = 9e9;
  34.         local playerHum = player.Character.HumanoidRootPart;
  35.         local workspaceChild = workspace:GetChildren();
  36.         for i = 1, #workspaceChild do
  37.             local v = workspaceChild[i];
  38.             local mobHum = v:FindFirstChild("Humanoid");
  39.             if v:IsA'Model' and v.Name:find'Weak' and not players:FindFirstChild(v.Name) and mobHum and mobHum.Health > 0 then
  40.                 local mobRootPart = v.HumanoidRootPart;
  41.                 local magnitude = (playerHum.Position - mobRootPart.Position).Magnitude;
  42.                 if magnitude < nearestM then
  43.                     nearestM = magnitude;
  44.                     nearest = mobRootPart;
  45.                 end
  46.             end
  47.         end
  48.         return nearest, nearestM, playerHum
  49.     end
  50.    
  51.     runService.Stepped:Connect(function()
  52.         local humanoid = player.Character:WaitForChild("Humanoid");
  53.         humanoid:ChangeState(11);
  54.         equip();
  55.         punch();
  56.     end)
  57.    
  58.     while _G.autofarm == true do
  59.         local nearest, distance, playerHum = getNearestMob();
  60.         if nearest then
  61.             local mob = nearest.Parent;
  62.             repeat
  63.                 mob.Humanoid.Health = 0
  64.                 local playerCFrame = playerHum.CFrame;
  65.                 local mobPos = nearest.Position;
  66.                 local tpCFrame = cframeNew((mobPos - constVec), mobPos)
  67.                 local tweenBase = tweenService:Create(playerHum, tweenInfoNew(distance / 90), {CFrame = tpCFrame});
  68.                 tweenBase:Play();
  69.                 tweenBase.Completed:Wait();
  70.             until mob.Humanoid.Health <= 0;
  71.         end
  72.         wait(2.5);
  73.     end;
  74.     end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top