Advertisement
rexscripts

Box Simulator script – (Autofarm, AutoCollect)

Mar 9th, 2022
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. -- | Variables | --
  2.  
  3. local root = game:GetService("Players").LocalPlayer.Character.HumanoidRootPart
  4.  
  5. _G.autofarm = true
  6. _G.autocollect = true
  7.  
  8.  
  9. ---------------------------------------------
  10.  
  11.  
  12. -- | Script | --
  13.  
  14. function getclosestbox()
  15. local dist,box = math.huge
  16. for i,v in pairs(game:GetService("Workspace").Map.Worlds:GetDescendants()) do
  17. if v:IsA("MeshPart") and v.Parent.Name == "Boxes" and v.Parent:IsA("Folder") then
  18. local magnitude = (root.Position - v.Position).magnitude
  19. if magnitude < dist then
  20. dist = magnitude
  21. box = v
  22. end
  23. end
  24. end
  25. return box
  26. end
  27.  
  28.  
  29.  
  30. function autocollect()
  31. if _G.autocollect then
  32. for i,v in pairs(game:GetService("Workspace").Map.Orbs:GetChildren()) do
  33. v.CFrame = CFrame.new(root.Position)
  34. end
  35. end
  36. end
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43. while _G.autofarm do wait(0.3)
  44. fireclickdetector(getclosestbox().ClickDetector)
  45. end
  46.  
  47. while _G.autocollect do wait()
  48. autocollect()
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement