0lf3_

Auto Collect Items Script (3008)

Aug 7th, 2022
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.67 KB | None | 0 0
  1. --Created by Qcalnik (Edited)
  2.  
  3. --[[ Settings ]]
  4. local TimesToTeleport = 50
  5. local Radius = 100
  6.  
  7. --[[ Variables ]]
  8. local PS = game:GetService("Players")
  9. local WS = game:GetService("Workspace")
  10. local Player = PS.LocalPlayer
  11. local PlayerGui = Player:WaitForChild("PlayerGui")
  12. local Character = PS.LocalPlayer.Character or PS.LocalPlayer.CharacterAdded:Wait()
  13. local Backpack = Player:WaitForChild("Backpack")
  14. local HumanoidRoot = Character:WaitForChild("HumanoidRootPart")
  15. local ItemsFolder = WS:WaitForChild("GameObjects").Physical.Items
  16. local Storage = PlayerGui:WaitForChild("MainGui").Menus.Inventory
  17.  
  18. --[[ Remotes ]]
  19. local Pickup = Character.System.Action
  20.  
  21.  
  22. local OldCFrame = HumanoidRoot.CFrame
  23. local OldPosition = HumanoidRoot.Position
  24.  
  25. function Check(Object)
  26. if Object.Name == "Crowbar" then
  27. return false
  28. end
  29. if Object:FindFirstChildOfClass("Part") or Object:FindFirstChildOfClass("MeshPart") then
  30. local Part = Object:FindFirstChildOfClass("Part") or Object:FindFirstChildOfClass("MeshPart")
  31. local Distance = (OldPosition - Part.Position).magnitude
  32. if Distance < Radius then
  33. return false
  34. end
  35. return true, Part
  36. end
  37. return false
  38. end
  39.  
  40. function InvetoryCheck()
  41. local StorageAmount = Storage.UpperLine.Storage
  42. if StorageAmount.Text == "16/16 items" or StorageAmount.Text == "17/16 items" then
  43. HumanoidRoot.CFrame = OldCFrame
  44. wait()
  45. for i,v in pairs(Backpack:GetChildren()) do
  46.  
  47. local A_1 = "Inventory_DropAll"
  48. local A_2 =
  49. {
  50. ["Tool"] = v.Name
  51. }
  52. Pickup:InvokeServer(A_1, A_2)
  53.  
  54. end
  55. repeat task.wait() until StorageAmount.Text == "0/16 items"
  56. end
  57. return "Done"
  58. end
  59.  
  60. local Amount = 0
  61. for i,v in pairs(WS:GetDescendants()) do
  62. if v.Name == "Apple" or v.Name == "Banana" or v.Name == "Bloxy Soda" or v.Name == "Burger" or v.Name == "Cookie" or v.Name == "Dr. Bob Soda" or v.Name == "Hotdog" or v.Name == "Ice Cream" or v.Name == "Lemon" or v.Name == "Lemon Slice" or v.Name == "Medkit" or v.Name == "Pizza" or v.Name == "Water" or v.Name == "2 Litre Dr. Bob" then --trollll
  63. if v:FindFirstChild(v.Name) or v:FindFirstChild("Root") then
  64. local Bool, Part = Check(v)
  65. if Bool then
  66. Amount = Amount + 1
  67. if Amount >= TimesToTeleport then
  68. HumanoidRoot.CFrame = OldCFrame
  69. return;
  70. else
  71. repeat task.wait()
  72. repeat task.wait() until InvetoryCheck() == "Done"
  73. Bool, Part = Check(v)
  74. if Part ~= nil then
  75. HumanoidRoot.CFrame = Part.CFrame
  76.  
  77. local A_1 = "Store"
  78. local A_2 =
  79. {
  80. ["Model"] = v
  81. }
  82.  
  83. Pickup:InvokeServer(A_1, A_2)
  84. end
  85. until Part == nil
  86. end
  87. end
  88. end
  89. end
  90. end
Add Comment
Please, Sign In to add comment