Advertisement
SK1R4_script

Blox Fruit auto chest Farm v2 (v1.1 might be better but whatever)

Dec 28th, 2024 (edited)
438
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.65 KB | None | 0 0
  1. -- v2 by Skira
  2.  
  3. local player = game.Players.LocalPlayer
  4. local character = player.Character or player.CharacterAdded:Wait()
  5. local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
  6.  
  7. local chests = {}
  8. for _, obj in pairs(workspace:GetDescendants()) do
  9. if obj.Name == "Chest1" or obj.Name == "Chest2" or obj.Name == "Chest3" then
  10. table.insert(chests, obj)
  11. end
  12. end
  13.  
  14. local screenGui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui"))
  15. local title = Instance.new("TextLabel", screenGui)
  16. title.Size = UDim2.new(0, 400, 0, 30)
  17. title.Position = UDim2.new(0.5, -200, 0.7, -50)
  18. title.Text = "Chest Auto Farm by Skira"
  19. title.TextSize = 18
  20. title.TextColor3 = Color3.fromRGB(255, 255, 255)
  21. title.BackgroundTransparency = 1
  22.  
  23. local button1 = Instance.new("TextButton", screenGui)
  24. button1.Size = UDim2.new(0, 80, 0, 30)
  25. button1.Position = UDim2.new(0.5, -140, 0.8, -40)
  26. button1.Text = "Chest1"
  27. button1.BackgroundColor3 = Color3.fromRGB(169, 169, 169)
  28.  
  29. local button2 = Instance.new("TextButton", screenGui)
  30. button2.Size = UDim2.new(0, 80, 0, 30)
  31. button2.Position = UDim2.new(0.5, -50, 0.8, -40)
  32. button2.Text = "Chest2"
  33. button2.BackgroundColor3 = Color3.fromRGB(169, 169, 169)
  34.  
  35. local button3 = Instance.new("TextButton", screenGui)
  36. button3.Size = UDim2.new(0, 80, 0, 30)
  37. button3.Position = UDim2.new(0.5, 40, 0.8, -40)
  38. button3.Text = "Chest3"
  39. button3.BackgroundColor3 = Color3.fromRGB(169, 169, 169)
  40.  
  41. local autoFarmButton = Instance.new("TextButton", screenGui)
  42. autoFarmButton.Size = UDim2.new(0, 200, 0, 50)
  43. autoFarmButton.Position = UDim2.new(0.5, -100, 0.9, -25)
  44. autoFarmButton.Text = "OFF"
  45. autoFarmButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
  46.  
  47. local TweenService = game:GetService("TweenService")
  48.  
  49. local function moveToChest(chest)
  50. local distance = (chest.Position - humanoidRootPart.Position).magnitude
  51. local duration = distance / 300
  52. local targetPos = chest.Position + Vector3.new(0, 3, 0)
  53. local tweenInfo = TweenInfo.new(duration, Enum.EasingStyle.Linear)
  54. local goal = {CFrame = CFrame.new(targetPos)}
  55. local tween = TweenService:Create(humanoidRootPart, tweenInfo, goal)
  56. tween:Play()
  57. tween.Completed:Wait()
  58. end
  59.  
  60. local isOn = false
  61. local selectedChest = nil
  62. local lastTweenTime = 0
  63.  
  64. local function toggleAutoFarm()
  65. if isOn then
  66. autoFarmButton.Text = "OFF"
  67. autoFarmButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
  68. isOn = false
  69. else
  70. autoFarmButton.Text = "ON"
  71. autoFarmButton.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
  72. isOn = true
  73. while isOn do
  74. local currentTime = tick()
  75. if selectedChest then
  76. moveToChest(selectedChest)
  77. else
  78. local randomChest = chests[math.random(1, #chests)]
  79. moveToChest(randomChest)
  80. end
  81. lastTweenTime = currentTime
  82. wait(1)
  83. end
  84. end
  85. end
  86.  
  87. local function toggleChestSelection(chestIndex, button)
  88. if button.BackgroundColor3 == Color3.fromRGB(169, 169, 169) then
  89. button.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
  90. selectedChest = chests[chestIndex]
  91. else
  92. button.BackgroundColor3 = Color3.fromRGB(169, 169, 169)
  93. if selectedChest == chests[chestIndex] then
  94. selectedChest = nil
  95. end
  96. end
  97. end
  98.  
  99. autoFarmButton.MouseButton1Click:Connect(toggleAutoFarm)
  100. button1.MouseButton1Click:Connect(function() toggleChestSelection(1, button1) end)
  101. button2.MouseButton1Click:Connect(function() toggleChestSelection(2, button2) end)
  102. button3.MouseButton1Click:Connect(function() toggleChestSelection(3, button3) end)
  103.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement