Advertisement
MiNerVaRXRX

LUA BloxBurg Auto Farm AFK

Jul 17th, 2019
467
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.56 KB | None | 0 0
  1.  
  2.  
  3. local Players = game.Players
  4.  
  5. local Player = Players['LocalPlayer']
  6.  
  7.  
  8.  
  9. local Character = Player.Character or Player.CharacterAdded:wait()
  10.  
  11. local HRP = Character['HumanoidRootPart']
  12.  
  13. local Stat = workspace.Stats[Player.Name]
  14.  
  15.  
  16.  
  17. local DE = game.ReplicatedStorage.DataEvent
  18.  
  19. local UE = Player.PlayerGui.MainGUI.Scripts.Inventory.UpdateEvent
  20.  
  21.  
  22.  
  23. local PP = workspace.PizzaPlanet
  24.  
  25. local Stations = PP['BakerWorkstations']
  26.  
  27. local Crates = PP['IngredientCrates']
  28.  
  29. local Working, Stocking = true
  30.  
  31.  
  32.  
  33. Stat.Job:GetPropertyChangedSignal('Value'):Connect(function()
  34.  
  35. if Stat.Job.Value == 'PizzaPlanetBaker' then Working = false
  36.  
  37. else Working = true end
  38.  
  39. end)
  40.  
  41. if Stat.Job.Value == 'PizzaPlanetBaker' then Working = false end
  42.  
  43.  
  44.  
  45. local Orders = {
  46.  
  47. Cheese = {true,true,true,false};
  48.  
  49. Vegetable = {true,true,true,'Vegetable'};
  50.  
  51. Ham = {true,true,true,'Ham'};
  52.  
  53. Pepperoni = {true,true,true,'Pepperoni'}
  54.  
  55. }
  56.  
  57.  
  58.  
  59. local CrateTP = Vector3.new(1163.78955, 13.5, 258.54892)
  60.  
  61. local Positions = {
  62.  
  63. Vector3.new(1173.34778, 13.5, 226.585571),
  64.  
  65. Vector3.new(1172.8501, 13.5, 238.183029),
  66.  
  67. Vector3.new(1173.20837, 13.5, 250.465881),
  68.  
  69. Vector3.new(1173.47266, 13.5, 259.170837)
  70.  
  71. }
  72.  
  73.  
  74.  
  75. local Part1 = coroutine.wrap(function()
  76.  
  77. while wait() do
  78.  
  79. for __, station in next, (Stations:GetChildren()) do
  80.  
  81. if Working then break end
  82.  
  83. local CT = station:FindFirstChild('CounterTop')
  84.  
  85. if CT then CT.Parent = nil end
  86.  
  87. station.InUse.Value = Player
  88.  
  89.  
  90.  
  91. local Pos = Positions[__]
  92.  
  93. Character.Humanoid.WalkToPoint = Pos
  94.  
  95. repeat wait() until (HRP.Position - Pos).magnitude < 2 or Working
  96.  
  97. if Working then break end
  98.  
  99.  
  100.  
  101. local NI = station['OrderDisplay']['DisplayMain']:FindFirstChild('NoIngredients',true)
  102.  
  103. if NI and NI.Visible and not Working then
  104.  
  105. Stocking = true
  106.  
  107. local Pos = CrateTP
  108.  
  109. Character.Humanoid.WalkToPoint = Pos
  110.  
  111. repeat wait() until (HRP.Position - Pos).magnitude < 2.75 or Working
  112.  
  113. if Working then break end
  114.  
  115.  
  116.  
  117. local Crate = Crates.Crate;
  118.  
  119. for __, cr in next, (Crates:GetChildren()) do
  120.  
  121. if (cr.Position - HRP.Position).magnitude < (Crate.Position - HRP.Position).magnitude then
  122.  
  123. Crate = cr
  124.  
  125. end
  126.  
  127. end
  128.  
  129. Crate.Parent = game.Lighting.TempFolder
  130.  
  131. wait()
  132.  
  133. DE:FireServer({
  134.  
  135. Object = game.Lighting.TempFolder.Crate,
  136.  
  137. Type = 'TakeIngredientCrate'
  138.  
  139. })
  140.  
  141. Crate.Parent = Crates
  142.  
  143. UE:Fire(Stat.EquippedItem)
  144.  
  145. wait()
  146.  
  147. end
  148.  
  149.  
  150.  
  151. local Pos = Positions[__]
  152.  
  153. Character.Humanoid.WalkToPoint = Pos
  154.  
  155. repeat wait() until (HRP.Position - Pos).magnitude < 2 or Working
  156.  
  157. if Working then break end
  158.  
  159. if Stocking then
  160.  
  161. DE:FireServer({
  162.  
  163. Workstation = station,
  164.  
  165. Type = 'RestockIngredients'
  166.  
  167. })
  168.  
  169. end
  170.  
  171. Stocking = false
  172.  
  173. end
  174.  
  175. for i = #Positions, 1, -1 do
  176.  
  177. local station = Stations:GetChildren()[i]
  178.  
  179. if Working then break end
  180.  
  181. local CT = station:FindFirstChild('CounterTop')
  182.  
  183. if CT then CT.Parent = nil end
  184.  
  185. station.InUse.Value = Player
  186.  
  187.  
  188.  
  189. local Pos = Positions[i]
  190.  
  191. Character.Humanoid.WalkToPoint = Pos
  192.  
  193. repeat wait() until (HRP.Position - Pos).magnitude < 2 or Working
  194.  
  195. if Working then break end
  196.  
  197.  
  198.  
  199. local NI = station['OrderDisplay']['DisplayMain']:FindFirstChild('NoIngredients',true)
  200.  
  201. if NI and NI.Visible and not Working then
  202.  
  203. Stocking = true
  204.  
  205. local Pos = CrateTP
  206.  
  207. Character.Humanoid.WalkToPoint = Pos
  208.  
  209. repeat wait() until (HRP.Position - Pos).magnitude < 2.75 or Working
  210.  
  211. if Working then break end
  212.  
  213.  
  214.  
  215. local Crate = Crates.Crate;
  216.  
  217. for __, cr in next, (Crates:GetChildren()) do
  218.  
  219. if (cr.Position - HRP.Position).magnitude < (Crate.Position - HRP.Position).magnitude then
  220.  
  221. Crate = cr
  222.  
  223. end
  224.  
  225. end
  226.  
  227. Crate.Parent = game.Lighting.TempFolder
  228.  
  229. wait()
  230.  
  231. DE:FireServer({
  232.  
  233. Object = game.Lighting.TempFolder.Crate,
  234.  
  235. Type = 'TakeIngredientCrate'
  236.  
  237. })
  238.  
  239. Crate.Parent = Crates
  240.  
  241. UE:Fire(Stat.EquippedItem)
  242.  
  243. wait()
  244.  
  245. end
  246.  
  247.  
  248.  
  249. local Pos = Positions[i]
  250.  
  251. Character.Humanoid.WalkToPoint = Pos
  252.  
  253. repeat wait() until (HRP.Position - Pos).magnitude < 2 or Working
  254.  
  255. if Working then break end
  256.  
  257. if Stocking then
  258.  
  259. DE:FireServer({
  260.  
  261. Workstation = station,
  262.  
  263. Type = 'RestockIngredients'
  264.  
  265. })
  266.  
  267. end
  268.  
  269. Stocking = false
  270.  
  271. end
  272.  
  273. end
  274.  
  275. end)
  276.  
  277.  
  278.  
  279. local Part2 = coroutine.wrap(function()
  280.  
  281. while wait(1) do
  282.  
  283. for __, station in next, (Stations:GetChildren()) do
  284.  
  285. if Working or Stocking then break end
  286.  
  287. local send = Orders[station.Order.Value]
  288.  
  289. local count = station.Order.IngredientsLeft.Value
  290.  
  291. DE:FireServer({
  292.  
  293. Workstation = station,
  294.  
  295. Type = 'UseWorkstation'
  296.  
  297. })
  298.  
  299.  
  300.  
  301. if Working or Stocking then break end
  302.  
  303. if count > 2 then count = count - 1 end
  304.  
  305. for i = 1, count do
  306.  
  307. DE:FireServer({
  308.  
  309. Workstation = station,
  310.  
  311. Type = 'UseWorkstation'
  312.  
  313. })
  314.  
  315. end
  316.  
  317.  
  318.  
  319. if Working or Stocking then break end
  320.  
  321.  
  322.  
  323. DE:FireServer({
  324.  
  325. Order = send,
  326.  
  327. Workstation = station,
  328.  
  329. Type = 'FinishOrder'
  330.  
  331. })
  332.  
  333. UE:Fire(Stat.Job.ShiftEarnings)
  334.  
  335. end
  336.  
  337. end
  338.  
  339. end)
  340.  
  341.  
  342.  
  343. Part1()
  344.  
  345. Part2()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement