NathanGamer1

AFk farm

Oct 6th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. local player = game:GetService'Players'.LocalPlayer
  2. local soundscript = player.PlayerGui.MainGUI.Scripts.SoundHandler
  3. local correct = soundscript.Local:FindFirstChild'Correct'
  4. local registry = getreg or debug.getregistry
  5. local datamodule = nil
  6. local running = false
  7.  
  8. for k, v in pairs(registry()) do
  9. if type(v) == "function" then
  10. local good, ups = pcall(debug.getupvalues, v)
  11. if good and ups then
  12. for i, z in next, ups do
  13. if type(z) == "table" and z.FireServer ~= nil then
  14. datamodule = z
  15. break
  16. end
  17. end
  18. end
  19. end
  20. end
  21.  
  22. assert(datamodule, "DataModule could not be found!")
  23. local oldfire = datamodule.FireServer
  24.  
  25. function datamodule:FireServer(tbl)
  26. if tbl.Type == "UseHatchet" then
  27. local rem = datamodule:Get(tbl.Type)
  28. repeat
  29. rem:FireServer({Time = math.random(100), Tree = tbl.Tree})
  30. wait(0.25)
  31. until (correct.IsPlaying or running == false)
  32. wait(0.25)
  33. correct.Playing = false --ugly fix but the sound is like 5 second long for some reason and i was skipping trees becasue of it
  34. return
  35. end
  36. return oldfire(self, tbl)
  37. end
  38.  
  39. game:GetService'UserInputService'.InputBegan:Connect(function(key, processed)
  40. if key.KeyCode == Enum.KeyCode.L and not processed then
  41. running = not running
  42. warn("RUNNING:", running)
  43.  
  44. spawn(function()
  45. while running do
  46. local char = player.Character or player.CharacterAdded:Wait()
  47. char.Humanoid.WalkSpeed = 16
  48. for k, v in ipairs(game:GetService'Workspace'.Trees:GetChildren()) do
  49. if v.ClassName == "Model" and v.PrimaryPart.Position.Y - char.HumanoidRootPart.Position.Y < 20 then
  50. repeat
  51. char.Humanoid:ChangeState(11)
  52. char.Humanoid:MoveTo(v.PrimaryPart.Position + Vector3.new(2, 0, 0))
  53. wait()
  54. until ((char.HumanoidRootPart.Position - v.PrimaryPart.Position).magnitude < 10 or running == false)
  55.  
  56. if not running then
  57. break
  58. end
  59. datamodule:FireServer({Type = "UseHatchet", Tree = v})
  60. end
  61. end
  62. end
  63. end)
  64. end
  65. end)
Add Comment
Please, Sign In to add comment