humarb

Test2

Aug 2nd, 2025 (edited)
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.50 KB | None | 0 0
  1. -- Var
  2. local moveStud = 15
  3. local buyMuch = 3
  4. local buyParent = "Volcano"
  5. local buyList = {"Volcanic Luck Potion", "Volcanic Strength Potion"}
  6. --local NPCSell = "Cavern"
  7. local maxBackpack = 450
  8. local listSafe = {"Uranium", "Cinnabar", "Diamond", "Aetherite", "Flarebloom", "Volcanic Core", "Prismara", "Vortessence", "Inferlume", "Painite", "Pink Diamond", "Dinosaur Skull"}
  9.  
  10. local Players = game:GetService("Players")
  11. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  12. local RunService = game:GetService("RunService")
  13.  
  14. local player = Players.LocalPlayer
  15. local character = player.Character or player.CharacterAdded:Wait()
  16.  
  17. local PlayerGui = player:WaitForChild("PlayerGui")
  18. local humanoid = character:WaitForChild("Humanoid")
  19. local animator = humanoid:WaitForChild("Animator")
  20. local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
  21.  
  22. print("[+] Character loaded:", character)
  23.  
  24. local tool = character:FindFirstChildOfClass("Tool")
  25. if not tool then
  26. warn("- Pan tidak ditemukan.")
  27. return
  28. end
  29.  
  30. print("[+] Tool loaded:", tool)
  31.  
  32. local scriptsFolder = tool:FindFirstChild("Scripts")
  33. if not scriptsFolder then
  34. warn("- Folder Scripts tidak ditemukan dalam tool.")
  35. return
  36. end
  37.  
  38. -- Move
  39. local startFrame = humanoidRootPart.CFrame
  40. local startPos = humanoidRootPart.Position
  41. local startLook = startFrame - startPos
  42.  
  43. -- Dig
  44. local collectRemote = scriptsFolder:FindFirstChild("Collect")
  45. local toggleRemote = scriptsFolder:WaitForChild("ToggleShovelActive")
  46.  
  47. -- Pan
  48. local panRemote = scriptsFolder:WaitForChild("Pan")
  49. local shakeRemote = scriptsFolder:WaitForChild("Shake")
  50.  
  51. -- Sell
  52. local backpack = player:WaitForChild("Backpack")
  53. local isiBackpack = #backpack:GetChildren()
  54. local ShopRemotes = ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("Shop")
  55. local merchant = workspace:WaitForChild("NPCs"):WaitForChild("Mountain"):GetChildren()[5]
  56.  
  57. -- Buy Item
  58.  
  59. -- Animations
  60. local panningAnims = ReplicatedStorage.Assets.Animations.Panning
  61. local animWindUp = animator:LoadAnimation(panningAnims.DigWindUp)
  62. local animDig = animator:LoadAnimation(panningAnims.Dig)
  63. local animHit = animator:LoadAnimation(panningAnims.DigHit)
  64. local animWash = animator:LoadAnimation(panningAnims.Wash)
  65. local animShake = animator:LoadAnimation(panningAnims.Shake)
  66.  
  67. -- UI
  68. local fillingUI = PlayerGui:WaitForChild("ToolUI").DigBar
  69. local fillLine = fillingUI:WaitForChild("Line")
  70.  
  71. -- Attribute references
  72. local stats = player:WaitForChild("Stats")
  73. local capacity = stats:GetAttribute("Capacity")
  74. local digSpeed = stats:GetAttribute("DigSpeed")
  75.  
  76. -- Sounds
  77. local handle = tool:WaitForChild("Handle")
  78. local digSound = handle:WaitForChild("Dig")
  79. local perfectSound = scriptsFolder:WaitForChild("Sounds"):WaitForChild("PerfectDig")
  80.  
  81. -- Flags
  82. local isDigging = false
  83. local running = false
  84. local needDig = true
  85. local maxStuck = 10
  86. local countStuck = 0
  87.  
  88. local function moveRelative(stud)
  89. -- Hitung posisi target
  90. local targetPos = humanoidRootPart.Position + humanoidRootPart.CFrame.LookVector * stud
  91.  
  92. -- Gerakkan
  93. humanoid:MoveTo(targetPos)
  94.  
  95. local reached = false
  96. humanoid.MoveToFinished:Connect(function()
  97. reached = true
  98. end)
  99.  
  100. local timeout = 5
  101. local start = tick()
  102. while not reached and tick() - start < timeout do
  103. task.wait(0.1)
  104. end
  105.  
  106. -- Kembalikan arah hadap awal
  107. humanoidRootPart.CFrame = CFrame.new(humanoidRootPart.Position) * startLook
  108. end
  109.  
  110. local function moveToNoTime(targetPoint)
  111. local targetReached = false
  112.  
  113. -- listen for the humanoid reaching its target
  114. local connection
  115. connection = humanoid.MoveToFinished:Connect(function(reached)
  116. targetReached = true
  117. connection:Disconnect()
  118. connection = nil
  119. end)
  120.  
  121. -- start walking
  122. humanoid:MoveTo(targetPoint)
  123.  
  124. while not targetReached do
  125. -- does the humanoid still exist?
  126. if not (humanoid and humanoid.Parent) then
  127. break
  128. end
  129. -- has the target changed?
  130. if humanoid.WalkToPoint ~= targetPoint then
  131. break
  132. end
  133. -- refresh the timeout
  134. humanoid:MoveTo(targetPoint)
  135. task.wait(6)
  136. end
  137.  
  138. -- disconnect the connection if it is still connected
  139. if connection then
  140. connection:Disconnect()
  141. connection = nil
  142. end
  143. end
  144.  
  145. local function stringInArray(str, arr)
  146. for _, v in ipairs(arr) do
  147. if v == str then
  148. return true
  149. end
  150. end
  151. return false
  152. end
  153.  
  154. local function safeInventory(name)
  155. for num, itemBackpack in ipairs(backpack:GetChildren()) do
  156. local itemType = itemBackpack:GetAttribute("ItemType")
  157. local locked = itemBackpack:GetAttribute("Locked")
  158.  
  159. if itemType == "Valuable" and not locked and stringInArray(itemBackpack.Name, name) then
  160. ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("Inventory"):WaitForChild("ToggleLock"):FireServer(itemBackpack)
  161. break
  162. end
  163. end
  164. end
  165.  
  166. local function startDigging()
  167. local panFill = tool:GetAttribute("Fill") or 0
  168.  
  169. if isDigging then return end
  170. if panFill >= capacity then
  171. countStuck += 1
  172. needDig = false
  173. return
  174. end
  175.  
  176. isDigging = true
  177. local digSh = toggleRemote:FireServer(true)
  178.  
  179. -- Show UI
  180. fillingUI.Visible = true
  181. fillLine.Position = UDim2.new(0.5, 0, 1, 0)
  182.  
  183. local collect = collectRemote:InvokeServer()
  184. if collect then
  185. local reachedPerfect = false
  186. local progress = 0
  187. local clamped
  188. while isDigging do
  189. local delta = RunService.Heartbeat:Wait()
  190. progress = progress + digSpeed * 1.5 * delta
  191. clamped = math.clamp(progress, 0, 1)
  192. fillLine.Position = UDim2.new(0.5, 0, 1 - clamped, 0)
  193.  
  194. if clamped >= 1 then break end
  195. end
  196.  
  197. task.wait(0.17 / digSpeed)
  198.  
  199. -- Final invoke
  200. task.spawn(function()
  201. collectRemote:InvokeServer(1)
  202. end)
  203.  
  204. task.wait(0.95 / digSpeed)
  205.  
  206. countStuck = 0
  207. isDigging = false
  208. else
  209. countStuck += 1
  210. warn("[+] Digging: Failed")
  211. end
  212.  
  213. fillingUI.Visible = false
  214. toggleRemote:FireServer(false)
  215.  
  216. task.wait(1)
  217. end
  218.  
  219. local function startPanning()
  220. local fill = tool:GetAttribute("Fill")
  221.  
  222. -- Mulai Panning
  223. local result = panRemote:InvokeServer()
  224. if result then
  225. -- Mainkan animasi awal
  226. animWash:Play()
  227. task.wait(0.35) -- sesuai PanClient
  228.  
  229. -- Mainkan animasi shake
  230. animShake:Play()
  231. animShake:AdjustSpeed(1)
  232.  
  233. -- Loop shake hingga pan kosong
  234. while fill > 0 do
  235. shakeRemote:FireServer()
  236. task.wait(0.5)
  237. fill = tool:GetAttribute("Fill") or 0
  238. end
  239.  
  240. -- Hentikan animasi shake
  241. animShake:Stop()
  242. animWash:Stop()
  243.  
  244. countStuck = 0
  245. needDig = true
  246. else
  247. countStuck += 1
  248. warn("[+] Panning: Failed")
  249. end
  250. end
  251.  
  252. local function buyThing(list, amount)
  253. for numBuy, itemBuy in ipairs(list) do
  254. for numMuch = 1, amount, 1 do
  255. local itemToBuy = workspace:WaitForChild("Purchasable"):WaitForChild(buyParent):WaitForChild(itemBuy):WaitForChild("ShopItem")
  256. ShopRemotes:WaitForChild("BuyItem"):InvokeServer(itemToBuy)
  257.  
  258. task.wait(0.5)
  259. end
  260. end
  261. end
  262.  
  263. local function sellAll(tpBack)
  264. local prompt = merchant:FindFirstChild("DialogPrompt")
  265.  
  266. if not prompt then
  267. warn("- Tidak ditemukan ProximityPrompt pada NPC Merchant")
  268. return
  269. end
  270.  
  271. -- MOVE
  272.  
  273. local targetNPC = merchant.HumanoidRootPart.CFrame.Position + (merchant.HumanoidRootPart.CFrame.LookVector * 4)
  274. moveToNoTime(targetNPC)
  275.  
  276. task.wait(5)
  277.  
  278. fireproximityprompt(prompt)
  279.  
  280. local sellPrice = ShopRemotes:WaitForChild("GetInventorySellPrice"):InvokeServer()
  281. local sellAll = ShopRemotes:WaitForChild("SellAll")
  282.  
  283. if sellPrice then
  284. task.wait(5)
  285. sellAll:InvokeServer()
  286.  
  287. -- MOVE
  288.  
  289. moveToNoTime(tpBack.Position)
  290.  
  291. humanoidRootPart.CFrame = CFrame.new(humanoidRootPart.Position) * startLook
  292. else
  293. warn("[+] Sell All: Failed")
  294. end
  295. end
  296.  
  297. local function runningLoop(backFrame)
  298. while running and countStuck < maxStuck do
  299. isiBackpack = #backpack:GetChildren()
  300. --print("- Backpack:", isiBackpack)
  301. if isiBackpack < maxBackpack then
  302. while needDig do
  303. startDigging()
  304. end
  305.  
  306. task.wait(3)
  307.  
  308. moveRelative(moveStud)
  309.  
  310. task.wait(3)
  311.  
  312. startPanning()
  313.  
  314. task.wait(3)
  315.  
  316. moveRelative(-moveStud)
  317.  
  318. task.wait(2)
  319. safeInventory(listSafe)
  320. task.wait(2)
  321. else
  322. task.wait(3)
  323. sellAll(backFrame)
  324.  
  325. task.wait(2)
  326. buyThing(buyList, buyMuch)
  327. task.wait(2)
  328. end
  329. end
  330. end
  331.  
  332. -- UI
  333. local gui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui"))
  334. gui.Name = "AutoFarmGUI"
  335.  
  336. local frame = Instance.new("Frame", gui)
  337. frame.Size = UDim2.new(0, 150, 0, 100)
  338. frame.Position = UDim2.new(0, 10, 0.5, -50)
  339. frame.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  340. frame.BorderSizePixel = 0
  341. frame.BackgroundTransparency = 0.2
  342.  
  343. local toggleBtn = Instance.new("TextButton", frame)
  344. toggleBtn.Size = UDim2.new(1, -10, 0.4, -5)
  345. toggleBtn.Position = UDim2.new(0, 5, 0, 5)
  346. toggleBtn.Text = "Start"
  347. toggleBtn.BackgroundColor3 = Color3.fromRGB(100, 200, 100)
  348.  
  349. local endBtn = Instance.new("TextButton", frame)
  350. endBtn.Size = UDim2.new(1, -10, 0.4, -5)
  351. endBtn.Position = UDim2.new(0, 5, 0.55, 0)
  352. endBtn.Text = "End Script"
  353. endBtn.BackgroundColor3 = Color3.fromRGB(200, 100, 100)
  354.  
  355. -- Button Events
  356. toggleBtn.MouseButton1Click:Connect(function()
  357. running = not running
  358. if running then
  359. local newStartFrame = humanoidRootPart.CFrame
  360. toggleBtn.Text = "Running..."
  361. runningLoop(newStartFrame)
  362. else
  363. toggleBtn.Text = "Start"
  364. end
  365. end)
  366.  
  367. endBtn.MouseButton1Click:Connect(function()
  368. running = false
  369. gui:Destroy()
  370. end)
Advertisement
Add Comment
Please, Sign In to add comment