1. _G.isRunningFarm = true;
  2. local vim = game:GetService("VirtualInputManager");
  3. local plr = game:GetService("Players").LocalPlayer;
  4. local gameRegion = game:GetService("Workspace").Regions;
  5. local function click() -- Unsure if different resolutions affect this, good luck!
  6. vim:SendMouseButtonEvent(0, 0, 0, true, game, 0);
  7. vim:SendMouseButtonEvent(0, 0, 0, false, game, 0);
  8. end;
  9. local function startFarm(reg)
  10. pcall(function() -- Couldn't be bothered to find out why the game was randomly causing the script to throw an error for no reason.
  11. for i,v in pairs(gameRegion[reg].Entities:GetChildren()) do
  12. if v.Name ~= plr and v.Humanoid.Health > 0 then
  13. plr.Character.HumanoidRootPart.CFrame = CFrame.new(v.PrimaryPart.CFrame.Position);
  14. click();
  15. end;
  16. end;
  17. end);
  18. end;
  19. local function startCollect()
  20. for i, v in pairs(game:GetService("Workspace").Items:GetDescendants()) do
  21. if v:FindFirstChild("ProximityPrompt") then
  22. fireproximityprompt(v.ProximityPrompt);
  23. end;
  24. end;
  25. end;
  26. if plr.Character.Hitbox:FindFirstChild("HitboxTop") then
  27. for i,v in pairs(plr.Character.Hitbox:GetChildren()) do
  28. v:Remove(); --This is all it takes for god mode, you can also delete the folder instead of a for loop.
  29. end;
  30. end;
  31. while _G.isRunningFarm do
  32. task.wait(1);--Changing this will modify the teleport speed
  33. startCollect();
  34. if plr.Character.State.region.Value == "KnightsDungeonRegion" then
  35. startFarm("KnightsDungeon");
  36. else
  37. plr.Character.HumanoidRootPart.CFrame = CFrame.new(356, 29, -136);
  38. repeat
  39. task.wait(1);
  40. --print'debug';
  41. startCollect();
  42. if string.match(game:GetService("Workspace").Dungeons.DungeonEntrances.KnightsDungeon.CountdownUiHolder.CountdownHolder.ActionLabel.Text, "COOLDOWN") then
  43. startFarm("Lava");
  44. end;
  45. until game:GetService("Workspace").Dungeons.DungeonEntrances.KnightsDungeon.CountdownUiHolder.CountdownHolder.ActionLabel.Text == "WAITING FOR PLAYERS ..." or plr.Character.State.region.Value == "KnightsDungeonRegion" or _G.isRunningFarm == false;
  46. end;
  47. end;