Advertisement
MegumuSenpai

Dragon Adventures | Auto Collect

Jan 27th, 2020
42,569
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. -- Variable
  2. local player = game.Players.LocalPlayer
  3.  
  4. -- Auto Sell
  5. local function sell()
  6. for i, v in ipairs(player.Data.Resources:GetChildren()) do
  7. if v.Value >= 10000 then
  8. repeat
  9. player.Remote:FireServer("SellResource",{[1]=v.Name;[2]=1;})
  10. wait()
  11. until v.Value <= 9999
  12. end
  13. end
  14. end
  15.  
  16. -- Platform
  17. spawn(function()
  18. local plat = Instance.new("Part", workspace)
  19. plat.Size = Vector3.new(10, 1, 10)
  20. plat.Anchored = true
  21. while true do
  22. pcall(function()
  23. plat.CFrame = player.Character.HumanoidRootPart.CFrame + Vector3.new(0, -5.2, 0)
  24. end)
  25. wait()
  26. end
  27. end)
  28.  
  29. -- Collect
  30. while true do
  31. local v = nil;
  32. repeat
  33. local res = workspace.CollectionZones.Resources:GetChildren()
  34. v = res[math.random(1, #res)]
  35. wait()
  36. until v ~= nil
  37. sell()
  38. local tries = 20
  39. if v:IsA("Model") and v:FindFirstChildOfClass("MeshPart") then
  40. repeat
  41. pcall(function()
  42. player.Character.HumanoidRootPart.CFrame = v:FindFirstChildOfClass("MeshPart").CFrame + Vector3.new(0, -15, 0)
  43. end)
  44. wait(0.1)
  45. player.Remote:FireServer("PickResourceObj", v)
  46. tries = tries - 1
  47. until v == nil or v.Parent == nil or tries <= 0
  48. elseif not v:IsA("Model") then
  49. repeat
  50. pcall(function()
  51. player.Character.HumanoidRootPart.CFrame = v.CFrame + Vector3.new(0, -15, 0)
  52. end)
  53. wait(0.1)
  54. player.Remote:FireServer("PickResourceObj", v)
  55. tries = tries - 1
  56. until v == nil or v.Parent == nil or tries <= 0
  57. end
  58. wait(0.25)
  59. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement