koreanhackerman

Bloxburg Money Autofarm

Dec 4th, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.19 KB | None | 0 0
  1. local Players = game.Players
  2. local Player = Players['LocalPlayer']
  3. local Character = Player.Character or Player.CharacterAdded:wait()
  4. local HRP = Character['HumanoidRootPart']
  5. local Stat = workspace.Stats[Player.Name]
  6. local DE = game.ReplicatedStorage.DataEvent
  7. local UE = Player.PlayerGui.MainGUI.Scripts.Inventory.UpdateEvent
  8. local PP = workspace.PizzaPlanet
  9. local Stations = PP['BakerWorkstations']
  10. local Crates = PP['IngredientCrates']
  11. local Working, Stocking = true
  12. Stat.Job:GetPropertyChangedSignal('Value'):Connect(function()
  13.     if Stat.Job.Value == 'PizzaPlanetBaker' then Working = false
  14.     else Working = true end
  15. end)
  16. if Stat.Job.Value == 'PizzaPlanetBaker' then Working = false end
  17. local Orders = {
  18.     Cheese = {true,true,true,false};
  19.     Vegetable = {true,true,true,'Vegetable'};
  20.     Ham = {true,true,true,'Ham'};
  21.     Pepperoni = {true,true,true,'Pepperoni'}
  22. }
  23. local CrateTP = Vector3.new(1163.78955, 13.5, 258.54892)
  24. local Positions = {
  25.     Vector3.new(1173.34778, 13.5, 226.585571),
  26.     Vector3.new(1172.8501, 13.5, 238.183029),
  27.     Vector3.new(1173.20837, 13.5, 250.465881),
  28.     Vector3.new(1173.47266, 13.5, 259.170837)
  29. }
  30. local Part1 = coroutine.wrap(function()
  31.     while wait() do
  32.         for __, station in next, (Stations:GetChildren()) do
  33.             if Working then break end
  34.             local CT = station:FindFirstChild('CounterTop')
  35.             if CT then CT.Parent = nil end
  36.             station.InUse.Value = Player
  37.            
  38.             local Pos = Positions[__]
  39.             Character.Humanoid.WalkToPoint = Pos
  40.             repeat wait() until (HRP.Position - Pos).magnitude < 2 or Working
  41.             if Working then break end
  42.             local NI = station['OrderDisplay']['DisplayMain']:FindFirstChild('NoIngredients',true)
  43.             if NI and NI.Visible and not Working then
  44.                 Stocking = true
  45.                 local Pos = CrateTP
  46.                 Character.Humanoid.WalkToPoint = Pos
  47.                 repeat wait() until (HRP.Position - Pos).magnitude < 2.75 or Working
  48.                 if Working then break end
  49.                
  50.                 local Crate = Crates.Crate;
  51.                 for __, cr in next, (Crates:GetChildren()) do
  52.                     if (cr.Position - HRP.Position).magnitude < (Crate.Position - HRP.Position).magnitude then
  53.                         Crate = cr
  54.                     end
  55.                 end
  56.                 Crate.Parent = game.Lighting.TempFolder
  57.                 wait()
  58.                 DE:FireServer({
  59.                     Object = game.Lighting.TempFolder.Crate,
  60.                     Type = 'TakeIngredientCrate'
  61.                 })
  62.                 Crate.Parent = Crates
  63.                 UE:Fire(Stat.EquippedItem)
  64.                 wait()
  65.             end
  66.            
  67.             local Pos = Positions[__]
  68.             Character.Humanoid.WalkToPoint = Pos
  69.             repeat wait() until (HRP.Position - Pos).magnitude < 2 or Working
  70.             if Working then break end
  71.             if Stocking then
  72.                  DE:FireServer({
  73.                     Workstation = station,
  74.                     Type = 'RestockIngredients'
  75.                 })
  76.             end
  77.             Stocking = false
  78.         end
  79.         for i = #Positions, 1, -1 do
  80.             local station = Stations:GetChildren()[i]
  81.             if Working then break end
  82.             local CT = station:FindFirstChild('CounterTop')
  83.             if CT then CT.Parent = nil end
  84.             station.InUse.Value = Player
  85.            
  86.             local Pos = Positions[i]
  87.             Character.Humanoid.WalkToPoint = Pos
  88.             repeat wait() until (HRP.Position - Pos).magnitude < 2 or Working
  89.             if Working then break end
  90.             local NI = station['OrderDisplay']['DisplayMain']:FindFirstChild('NoIngredients',true)
  91.             if NI and NI.Visible and not Working then
  92.                 Stocking = true
  93.                 local Pos = CrateTP
  94.                 Character.Humanoid.WalkToPoint = Pos
  95.                 repeat wait() until (HRP.Position - Pos).magnitude < 2.75 or Working
  96.                 if Working then break end
  97.                
  98.                 local Crate = Crates.Crate;
  99.                 for __, cr in next, (Crates:GetChildren()) do
  100.                     if (cr.Position - HRP.Position).magnitude < (Crate.Position - HRP.Position).magnitude then
  101.                         Crate = cr
  102.                     end
  103.                 end
  104.                 Crate.Parent = game.Lighting.TempFolder
  105.                 wait()
  106.                 DE:FireServer({
  107.                     Object = game.Lighting.TempFolder.Crate,
  108.                     Type = 'TakeIngredientCrate'
  109.                 })
  110.                 Crate.Parent = Crates
  111.                 UE:Fire(Stat.EquippedItem)
  112.                 wait()
  113.             end
  114.            
  115.             local Pos = Positions[i]
  116.             Character.Humanoid.WalkToPoint = Pos
  117.             repeat wait() until (HRP.Position - Pos).magnitude < 2 or Working
  118.             if Working then break end
  119.             if Stocking then
  120.                  DE:FireServer({
  121.                     Workstation = station,
  122.                     Type = 'RestockIngredients'
  123.                 })
  124.             end
  125.             Stocking = false
  126.         end
  127.     end
  128. end)
  129. local Part2 = coroutine.wrap(function()
  130.     while wait(1) do
  131.         for __, station in next, (Stations:GetChildren()) do
  132.             if Working or Stocking then break end
  133.             local send = Orders[station.Order.Value]
  134.             local count = station.Order.IngredientsLeft.Value
  135.             DE:FireServer({
  136.                 Workstation = station,
  137.                 Type = 'UseWorkstation'
  138.             })
  139.            
  140.             if Working or Stocking then break end
  141.             if count > 2 then count = count - 1 end
  142.             for i = 1, count do
  143.                 DE:FireServer({
  144.                     Workstation = station,
  145.                     Type = 'UseWorkstation'
  146.                 })
  147.             end
  148.             if Working or Stocking then break end
  149.             DE:FireServer({
  150.                 Order = send,
  151.                 Workstation = station,
  152.                 Type = 'FinishOrder'
  153.             })
  154.             UE:Fire(Stat.Job.ShiftEarnings)
  155.         end
  156.     end
  157. end)
  158. Part1()
  159. Part2()
Add Comment
Please, Sign In to add comment