Advertisement
Legitwww

Booga Booga Script

Oct 10th, 2022 (edited)
636
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.48 KB | Gaming | 0 0
  1.  
  2.  
  3. local Players = game:GetService("Players")
  4. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  5. local TweenService = game:GetService("TweenService")
  6. local ui = loadstring(game:HttpGet("https://raw.githubusercontent.com/Singularity5490/rbimgui-2/main/rbimgui-2.lua"))()
  7. local window = ui.new({text="autofarm"})
  8. local tab = window.new({text = "main"})
  9. local autofarmToggle = tab.new("Switch", {text="autofarm"})
  10.  
  11. -- wrote this myself :sunglasses:
  12. local function getClosestObject(folder)
  13. local distance, part = math.huge, nil
  14. local mainPart
  15. for i,v in pairs(folder:GetChildren()) do
  16. local HRPPosition = Players.LocalPlayer.Character.HumanoidRootPart.Position
  17.  
  18. for i2,v2 in pairs(v:GetChildren()) do
  19. if v2:IsA("BasePart") then
  20. mainPart = v2
  21. break
  22. end
  23. end
  24.  
  25. if mainPart and not mainPart.Parent:FindFirstChild("Humanoid") and mainPart.Parent:FindFirstChild("Health") then
  26. local realDistance = math.abs((HRPPosition - mainPart.Position).Magnitude)
  27.  
  28. if realDistance < distance then
  29. distance = realDistance
  30. part = mainPart
  31. end
  32. end
  33. end
  34. return part
  35. end
  36.  
  37. local function getClosestPickups(folder)
  38. local pickups = {}
  39. for i,v in pairs(folder:GetChildren()) do
  40. if v:FindFirstChild("Pickup") and v:IsA("BasePart") and table.find(pickups,v) == nil then
  41. if (Players.LocalPlayer.Character.HumanoidRootPart.Position - v.Position).Magnitude <= 30 then
  42. table.insert(pickups, v)
  43. end
  44. end
  45. end
  46. return pickups
  47. end
  48.  
  49.  
  50. while wait(0.3) do
  51. if autofarmToggle.on then
  52. local part = getClosestObject(workspace)
  53. local HRPPosition = Players.LocalPlayer.Character.HumanoidRootPart.Position
  54. local realDistance = math.round(math.abs((HRPPosition - part.Position).Magnitude))
  55.  
  56. ReplicatedStorage.Events.SwingTool:FireServer(ReplicatedStorage.RelativeTime.Value, {
  57. [1] = part
  58. })
  59. for i,v in pairs(getClosestPickups(workspace)) do
  60. game:GetService("ReplicatedStorage").Events.Pickup:FireServer(v)
  61. end
  62. wait(0.1)
  63. if part.Position.Y <= 30 then
  64. TweenService:Create(Players.LocalPlayer.Character.HumanoidRootPart, TweenInfo.new(realDistance/10, Enum.EasingStyle.Linear), {CFrame=part.CFrame+Vector3.new(0,part.Size.Y,0)}):Play()
  65. task.wait(realDistance/10)
  66. end
  67. end
  68. end
Tags: Bogga Bogga
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement