Advertisement
Guest User

Untitled

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