Advertisement
Riwan9549

work at pizza place

Jun 15th, 2023
26,811
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.53 KB | None | 0 0
  1. --https://v3rmillion.net/showthread.php?tid=723696
  2. getupvalues = getupvalues or debug.getupvalues
  3. setupvalue = setupvalue or debug.setupvalue
  4. if not (getrawmetatable and getupvalues and setupvalue and (getreg or debug.getregistry)) then
  5. local h = Instance.new("Hint",workspace)
  6. h.Text = "Incompatible exploit."
  7. wait(3)
  8. h:Destroy()
  9. return
  10. end
  11. local settings = {refill_at=0, refill_end=60, deliver_at=24, stay_in_kitchen=true}
  12. local doCashier,doBoxer,doCook,doSupplier,doDelivery = true,true,true,true,true
  13. if readfile then
  14. pcall(function()
  15. local new = game:GetService("HttpService"):JSONDecode(readfile("PizzaFarm.txt"))
  16. --corruption?
  17. local doOverwrite=false
  18. for k,v in pairs(new) do
  19. if settings[k]==nil then
  20. doOverwrite=true
  21. new[k]=nil
  22. end
  23. end
  24. for k,v in pairs(settings) do
  25. if new[k]==nil then
  26. doOverwrite=true
  27. new[k]=v
  28. end
  29. end
  30. --use input
  31. if doOverwrite then
  32. warn("Settings overwritten")
  33. writefile("PizzaFarm.txt",game:GetService("HttpService"):JSONEncode(new))
  34. end
  35. settings = new
  36. end)
  37. end
  38.  
  39. if getconnections then
  40. for _,c in next,getconnections(game:GetService("ScriptContext").Error) do
  41. c:Disable()
  42. end
  43. end
  44.  
  45. local player = game:GetService("Players").LocalPlayer
  46. local ffc = game.FindFirstChild
  47. local RNG = Random.new()
  48. local network
  49. local character,root,humanoid
  50. do
  51. local reg = (getreg or debug.getregistry)()
  52. for i=1,#reg do
  53. local f = reg[i]
  54. if type(f)=="function" then
  55. for k,v in next,getupvalues(f) do
  56. if typeof(v)=="Instance" then
  57. if v.Name=="CashOut" then
  58. setupvalue(f,k,{MouseButton1Click={wait=function()end,Wait=function()end}})
  59. elseif v.Name=="StickerName" then
  60. setupvalue(f,k,nil)
  61. end
  62. end
  63. end
  64. if tostring(getfenv(f)) == "Music" then
  65. local consts = getconstants(f)
  66. local loc=false
  67. for ci,c in next,consts do
  68. if c == "location changed" then
  69. loc=true
  70. elseif loc and c == "SendData" then
  71. setconstant(f,ci,"ExplodeString")
  72. break
  73. end
  74. end
  75. end
  76. elseif type(f)=="table" and rawget(f,"FireServer") and rawget(f,"BindEvents") then
  77. network = f
  78. end
  79. end
  80. end
  81. assert(network,"failed to find network")
  82. --//gui
  83. Create = function(class,parent,props)
  84. local new = Instance.new(class)
  85. for k,v in next,props do
  86. new[k]=v
  87. end
  88. new.Parent = parent
  89. return new
  90. end
  91. gui=Create("ScreenGui",game.CoreGui,{Name="Farm", ZIndexBehavior="Sibling"})
  92. main=Create("Frame",gui,{Name="main", Draggable=true, Active=true, Size=UDim2.new(0,350,0,100), Position=UDim2.new(.335,0,0.02,0), BackgroundColor3=Color3.new(0.098,0.098,0.098)})
  93. topbar=Create("Frame",main,{Name="topbar", Size=UDim2.new(1,0,0.15,0), BackgroundColor3=Color3.new(0.255,0.255,0.255)})
  94. closeBtn=Create("TextButton",topbar,{Name="closeBtn", TextWrapped=true, Size=UDim2.new(0.03,0,1,0), TextColor3=Color3.new(1,1,1), Text="X", BackgroundTransparency=1,
  95. Font="GothamSemibold", Position=UDim2.new(0.96,0,0,0), TextSize=14, TextScaled=true, BackgroundColor3=Color3.new(1,1,1)})
  96. titleLbl=Create("TextLabel",topbar,{Name="titleLbl", TextWrapped=true, Size=UDim2.new(0.5,0,1,0), Text="Pizza Factory", TextSize=14, Font="GothamSemibold",
  97. BackgroundTransparency=1, Position=UDim2.new(0.25,0,0,0), TextColor3=Color3.new(1,1,1), BackgroundColor3=Color3.new(1,1,1)})
  98. saveBtn=Create("ImageButton",topbar,{Name="saveBtn", Image="rbxassetid://55687833", Size=UDim2.new(0.05,0,1,0), Position=UDim2.new(0.01,0,0,0), BackgroundTransparency=1, BackgroundColor3=Color3.new(), Visible=writefile~=nil})
  99. settings_1=Create("Frame",main,{Name="settings", BackgroundTransparency=1, Size=UDim2.new(0.97,0,0.75,0), Position=UDim2.new(0.025,0,0.2,0), BackgroundColor3=Color3.new(1,1,1)})
  100. Layout=Create("UIGridLayout",settings_1,{VerticalAlignment="Center", SortOrder="LayoutOrder", HorizontalAlignment="Center", CellPadding=UDim2.new(0.01,0,0.1,0), CellSize=UDim2.new(0.325,0,0.26,0)})
  101. cashier=Create("Frame",settings_1,{Name="cashier", LayoutOrder=4, BackgroundTransparency=1, Size=UDim2.new(0,100,0,100), BackgroundColor3=Color3.new(1,1,1)})
  102. Label=Create("TextLabel",cashier,{TextWrapped=true, Size=UDim2.new(0.6,0,1,0), Text="Cashier", TextSize=14, TextXAlignment="Left", Font="SourceSans",
  103. BackgroundTransparency=1, Position=UDim2.new(0.4,0,0,0), TextColor3=Color3.new(1,1,1), TextScaled=true, BackgroundColor3=Color3.new(1,1,1)})
  104. cashierBtn=Create("ImageButton",cashier,{Name="cashierBtn", ImageTransparency=1, BorderSizePixel=0, Size=UDim2.new(0.38,0,1,0), BackgroundColor3=Color3.new(0.392,0.392,0.392)})
  105. cashierSlider=Create("Frame",cashierBtn,{Name="slider", Size=UDim2.new(0.5,-4,1,-4), Position=UDim2.new(doCashier and 0.5 or 0,2,0,2), BorderSizePixel=0, BackgroundColor3=Color3.new(0.784,0.784,0.784)})
  106. kitchen=Create("Frame",settings_1,{Name="kitchen", LayoutOrder=9, BackgroundTransparency=1, Size=UDim2.new(0,100,0,100), BackgroundColor3=Color3.new(1,1,1)})
  107. Label_2=Create("TextLabel",kitchen,{TextWrapped=true, Size=UDim2.new(0.6,0,1,0), Text="Deliver At:", TextSize=14, TextXAlignment="Right", Font="SourceSans",
  108. BackgroundTransparency=1, TextColor3=Color3.new(1,1,1), TextScaled=true, BackgroundColor3=Color3.new(1,1,1)})
  109. deliverAtBox=Create("TextBox",kitchen,{Name="deliverAtBox", TextWrapped=true, Size=UDim2.new(0.25,0,1,0), Text=tostring(settings.deliver_at), TextSize=50, TextColor3=Color3.new(),
  110. Font="Code", Position=UDim2.new(0.62,0,0,0), TextScaled=true, BackgroundColor3=Color3.new(0.784,0.784,0.784)})
  111. refillEnd=Create("Frame",settings_1,{Name="refillEnd", LayoutOrder=8, BackgroundTransparency=1, Size=UDim2.new(0,100,0,100), BackgroundColor3=Color3.new(1,1,1)})
  112. refillEndBox=Create("TextBox",refillEnd,{Name="refillEndBox", TextWrapped=true, Size=UDim2.new(0.25,0,1,0), Text=tostring(settings.refill_end), TextSize=50, TextColor3=Color3.new(),
  113. Font="Code", Position=UDim2.new(0.62,0,0,0), TextScaled=true, BackgroundColor3=Color3.new(0.784,0.784,0.784)})
  114. Label_3=Create("TextLabel",refillEnd,{TextWrapped=true, Size=UDim2.new(0.6,0,1,0), Text="Refill End:", TextSize=14, TextXAlignment="Right", Font="SourceSans",
  115. BackgroundTransparency=1, TextColor3=Color3.new(1,1,1), TextScaled=true, BackgroundColor3=Color3.new(1,1,1)})
  116. refillAt=Create("Frame",settings_1,{Name="refillAt", LayoutOrder=7, BackgroundTransparency=1, Size=UDim2.new(0,100,0,100), BackgroundColor3=Color3.new(1,1,1)})
  117. Label_4=Create("TextLabel",refillAt,{TextWrapped=true, Size=UDim2.new(0.5,0,1,0), Text="Refill At:", TextSize=14, TextXAlignment="Right", Font="SourceSans",
  118. BackgroundTransparency=1, TextColor3=Color3.new(1,1,1), TextScaled=true, BackgroundColor3=Color3.new(1,1,1)})
  119. refillAtBox=Create("TextBox",refillAt,{Name="refillAtBox", TextWrapped=true, Size=UDim2.new(0.25,0,1,0), Text=tostring(settings.refill_at), TextSize=50, TextColor3=Color3.new(),
  120. Font="Code", Position=UDim2.new(0.52,0,0,0), TextScaled=true, BackgroundColor3=Color3.new(0.784,0.784,0.784)})
  121. supplier=Create("Frame",settings_1,{Name="supplier", LayoutOrder=6, BackgroundTransparency=1, Size=UDim2.new(0,100,0,100), BackgroundColor3=Color3.new(1,1,1)})
  122. Label_5=Create("TextLabel",supplier,{TextWrapped=true, Size=UDim2.new(0.6,0,1,0), Text="Supplier", TextSize=14, TextXAlignment="Left", Font="SourceSans",
  123. BackgroundTransparency=1, Position=UDim2.new(0.4,0,0,0), TextColor3=Color3.new(1,1,1), TextScaled=true, BackgroundColor3=Color3.new(1,1,1)})
  124. supplierBtn=Create("ImageButton",supplier,{Name="supplierBtn", ImageTransparency=1, BorderSizePixel=0, Size=UDim2.new(0.38,0,1,0), BackgroundColor3=Color3.new(0.392,0.392,0.392)})
  125. supplierSlider=Create("Frame",supplierBtn,{Name="slider", Size=UDim2.new(0.5,-4,1,-4), Position=UDim2.new(doSupplier and 0.5 or 0,2,0,2), BorderSizePixel=0, BackgroundColor3=Color3.new(0.784,0.784,0.784)})
  126. delivery=Create("Frame",settings_1,{Name="delivery", LayoutOrder=5, BackgroundTransparency=1, Size=UDim2.new(0,100,0,100), BackgroundColor3=Color3.new(1,1,1)})
  127. Label_6=Create("TextLabel",delivery,{TextWrapped=true, Size=UDim2.new(0.6,0,1,0), Text="Delivery", TextSize=14, TextXAlignment="Left", Font="SourceSans",
  128. BackgroundTransparency=1, Position=UDim2.new(0.4,0,0,0), TextColor3=Color3.new(1,1,1), TextScaled=true, BackgroundColor3=Color3.new(1,1,1)})
  129. deliveryBtn=Create("ImageButton",delivery,{Name="deliveryBtn", ImageTransparency=1, BorderSizePixel=0, Size=UDim2.new(0.38,0,1,0), BackgroundColor3=Color3.new(0.392,0.392,0.392)})
  130. deliverySlider=Create("Frame",deliveryBtn,{Name="slider", Size=UDim2.new(0.5,-4,1,-4), Position=UDim2.new(doDelivery and 0.5 or 0,2,0,2), BorderSizePixel=0, BackgroundColor3=Color3.new(0.784,0.784,0.784)})
  131. boxer=Create("Frame",settings_1,{Name="boxer", LayoutOrder=2, BackgroundTransparency=1, Size=UDim2.new(0,100,0,100), BackgroundColor3=Color3.new(1,1,1)})
  132. boxerLbl=Create("TextLabel",boxer,{TextWrapped=true, Size=UDim2.new(0.6,0,1,0), Text="Boxer", TextSize=14, TextXAlignment="Left", Font="SourceSans",
  133. BackgroundTransparency=1, Position=UDim2.new(0.4,0,0,0), TextColor3=Color3.new(1,1,1), TextScaled=true, BackgroundColor3=Color3.new(1,1,1)})
  134. boxerBtn=Create("ImageButton",boxer,{Name="boxerBtn", ImageTransparency=1, BorderSizePixel=0, Size=UDim2.new(0.38,0,1,0), BackgroundColor3=Color3.new(0.392,0.392,0.392)})
  135. boxerSlider=Create("Frame",boxerBtn,{Name="slider", Size=UDim2.new(0.5,-4,1,-4), Position=UDim2.new(doBoxer and 0.5 or 0,2,0,2), BorderSizePixel=0, BackgroundColor3=Color3.new(0.784,0.784,0.784)})
  136. cook=Create("Frame",settings_1,{Name="cook", LayoutOrder=3, BackgroundTransparency=1, Size=UDim2.new(0,100,0,100), BackgroundColor3=Color3.new(1,1,1)})
  137. cookLbl=Create("TextLabel",cook,{TextWrapped=true, Size=UDim2.new(0.6,0,1,0), Text="Cook", TextSize=14, TextXAlignment="Left", Font="SourceSans",
  138. BackgroundTransparency=1, Position=UDim2.new(0.4,0,0,0), TextColor3=Color3.new(1,1,1), TextScaled=true, BackgroundColor3=Color3.new(1,1,1)})
  139. cookBtn=Create("ImageButton",cook,{Name="cookBtn", ImageTransparency=1, BorderSizePixel=0, Size=UDim2.new(0.38,0,1,0), BackgroundColor3=Color3.new(0.392,0.392,0.392)})
  140. cookSlider=Create("Frame",cookBtn,{Name="slider", Size=UDim2.new(0.5,-4,1,-4), Position=UDim2.new(doCook and 0.5 or 0,2,0,2), BorderSizePixel=0, BackgroundColor3=Color3.new(0.784,0.784,0.784)})
  141. toggleAll=Create("Frame",settings_1,{Name="toggleAll", LayoutOrder=1, BackgroundTransparency=1, Size=UDim2.new(0,100,0,100), BackgroundColor3=Color3.new(1,1,1)})
  142. switch=Create("Frame",toggleAll,{Name="switch", BackgroundTransparency=1, Size=UDim2.new(0.75,0,1,0), BackgroundColor3=Color3.new(1,1,1)})
  143. allOffBtn=Create("ImageButton",switch,{Name="allOffBtn", ImageTransparency=1, BorderSizePixel=0, Size=UDim2.new(0.5,0,1,0), BackgroundColor3=Color3.new(0.235,0.235,0.235)})
  144. allOnBtn=Create("ImageButton",switch,{Name="allOnBtn", ImageTransparency=1, BorderSizePixel=0, Size=UDim2.new(0.5,0,1,0), Position=UDim2.new(0.5,0,0,0), BackgroundColor3=Color3.new(0.333,0.333,0.333)})
  145. toggleAllSlider=Create("Frame",switch,{Name="slider", Size=UDim2.new(0.1,0,1,4), Position=UDim2.new(0.45,0,0,-2), BorderSizePixel=0, BackgroundColor3=Color3.new(0.784,0.784,0.784)})
  146. messageLbl=Create("TextLabel",topbar,{Name="messageLbl", Size=UDim2.new(0.5,0,1,0), Text="Saved.", TextSize=14, Font="GothamSemibold", BackgroundTransparency=1,
  147. Position=UDim2.new(0.07,0,0,0), TextColor3=Color3.new(1,1,1), Visible=false, TextXAlignment="Left"})
  148. camframe=Create("Frame",gui,{Name="camframe", BackgroundTransparency=1, Size=UDim2.new(0,120,0,40), Position=UDim2.new(0.5,-320,0,-38), BackgroundColor3=Color3.new(0.118,0.118,0.118)})
  149. rightCamBtn=Create("ImageButton",camframe,{Name="rightCamBtn", Image="rbxassetid://144168163", Size=UDim2.new(0.333,0,1,0), Rotation=180, Position=UDim2.new(0.666,0,0,0), BackgroundTransparency=1,
  150. BackgroundColor3=Color3.new(1,1,1)})
  151. leftCamBtn=Create("ImageButton",camframe,{Name="leftCamBtn", Image="rbxassetid://144168163", Size=UDim2.new(0.333,0,1,0), BackgroundTransparency=1, BackgroundColor3=Color3.new(1,1,1)})
  152. centerCamBtn=Create("ImageButton",camframe,{Name="centerCamBtn", Image="rbxassetid://58282192", Size=UDim2.new(0.333,0,1,0), Position=UDim2.new(0.333,0,0,0), BackgroundTransparency=1, BackgroundColor3=Color3.new(1,1,1)})
  153. creditLbl=Create("TextLabel",main,{Position=UDim2.new(0,0,1,5),Size=UDim2.new(0,100,0,15),BackgroundTransparency=1,TextColor3=Color3.new(1,1,1),Text="by sirelKilla",TextScaled=true,TextStrokeTransparency=.8})
  154.  
  155. local function toggleCashier(bool)
  156. if bool~=nil then
  157. doCashier=bool
  158. else
  159. doCashier = not doCashier
  160. end
  161. cashierSlider:TweenPosition(UDim2.new(doCashier and 0.5 or 0,2,0,2),nil,"Sine",0.1,true)
  162. end
  163. local function toggleCook(bool)
  164. if bool~=nil then
  165. doCook=bool
  166. else
  167. doCook = not doCook
  168. end
  169. cookSlider:TweenPosition(UDim2.new(doCook and 0.5 or 0,2,0,2),nil,"Sine",0.1,true)
  170. end
  171. local function toggleBoxer(bool)
  172. if bool~=nil then
  173. doBoxer=bool
  174. else
  175. doBoxer = not doBoxer
  176. end
  177. boxerSlider:TweenPosition(UDim2.new(doBoxer and 0.5 or 0,2,0,2),nil,"Sine",0.1,true)
  178. end
  179. local function toggleDelivery(bool)
  180. if bool~=nil then
  181. doDelivery=bool
  182. else
  183. doDelivery = not doDelivery
  184. end
  185. deliverySlider:TweenPosition(UDim2.new(doDelivery and 0.5 or 0,2,0,2),nil,"Sine",0.1,true)
  186. end
  187. local function toggleSupplier(bool)
  188. if bool~=nil then
  189. doSupplier=bool
  190. else
  191. doSupplier = not doSupplier
  192. end
  193. supplierSlider:TweenPosition(UDim2.new(doSupplier and 0.5 or 0,2,0,2),nil,"Sine",0.1,true)
  194. end
  195. cashierBtn.MouseButton1Click:Connect(toggleCashier)
  196. cookBtn.MouseButton1Click:Connect(toggleCook)
  197. boxerBtn.MouseButton1Click:Connect(toggleBoxer)
  198. deliveryBtn.MouseButton1Click:Connect(toggleDelivery)
  199. supplierBtn.MouseButton1Click:Connect(toggleSupplier)
  200. allOffBtn.InputBegan:Connect(function()
  201. if game:GetService("UserInputService"):IsMouseButtonPressed(Enum.UserInputType.MouseButton1) then
  202. toggleCashier(false)
  203. toggleCook(false)
  204. toggleBoxer(false)
  205. toggleDelivery(false)
  206. toggleSupplier(false)
  207. toggleAllSlider:TweenPosition(UDim2.new(0,0,0,-2),nil,"Sine",0.1,true)
  208. wait(1)
  209. if toggleAllSlider.Position.X.Scale<.01 then
  210. toggleAllSlider:TweenPosition(UDim2.new(0.45,0,0,-2),nil,"Sine",0.1,true)
  211. end
  212. end
  213. end)
  214. allOnBtn.InputBegan:Connect(function()
  215. if game:GetService("UserInputService"):IsMouseButtonPressed(Enum.UserInputType.MouseButton1) then
  216. toggleCashier(true)
  217. toggleCook(true)
  218. toggleBoxer(true)
  219. toggleDelivery(true)
  220. toggleSupplier(true)
  221. toggleAllSlider:TweenPosition(UDim2.new(0.9,0,0,-2),nil,"Sine",0.1,true)
  222. wait(1)
  223. if toggleAllSlider.Position.X.Scale>.88 then
  224. toggleAllSlider:TweenPosition(UDim2.new(0.45,0,0,-2),nil,"Sine",0.1,true)
  225. end
  226. end
  227. end)
  228. local oldRefillAt=refillAtBox.Text
  229. refillAtBox:GetPropertyChangedSignal("Text"):Connect(function()
  230. if #refillAtBox.Text>2 or refillAtBox.Text:match("%D") then
  231. refillAtBox.Text = oldRefillAt
  232. end
  233. oldRefillAt = refillAtBox.Text
  234. end)
  235. refillAtBox.FocusLost:Connect(function()
  236. if tonumber(refillAtBox.Text) then
  237. settings.refill_at=tonumber(refillAtBox.Text)
  238. end
  239. refillAtBox.Text=tostring(settings.refill_at)
  240. end)
  241. local oldRefillEnd=refillEndBox.Text
  242. refillEndBox:GetPropertyChangedSignal("Text"):Connect(function()
  243. if #refillEndBox.Text>2 or refillEndBox.Text:match("%D") then
  244. refillEndBox.Text = oldRefillEnd
  245. end
  246. oldRefillEnd = refillEndBox.Text
  247. end)
  248. refillEndBox.FocusLost:Connect(function()
  249. if tonumber(refillEndBox.Text) then
  250. settings.refill_end=tonumber(refillEndBox.Text)
  251. end
  252. refillEndBox.Text=tostring(settings.refill_end)
  253. end)
  254. local oldDeliverAt=deliverAtBox.Text
  255. deliverAtBox:GetPropertyChangedSignal("Text"):Connect(function()
  256. if #deliverAtBox.Text>2 or deliverAtBox.Text:match("%D") then
  257. deliverAtBox.Text = oldDeliverAt
  258. end
  259. oldDeliverAt = deliverAtBox.Text
  260. end)
  261. deliverAtBox.FocusLost:Connect(function()
  262. if tonumber(deliverAtBox.Text) then
  263. settings.deliver_at=tonumber(deliverAtBox.Text)
  264. end
  265. deliverAtBox.Text=tostring(settings.deliver_at)
  266. end)
  267. closeBtn.MouseButton1Click:Connect(function()
  268. gui:Destroy()
  269. doCashier,doBoxer,doCook,doSupplier,doDelivery = false,false,false,false,false
  270. end)
  271. closeBtn.MouseEnter:Connect(function() closeBtn.TextColor3=Color3.new(.9,0,0) end)
  272. closeBtn.MouseLeave:Connect(function() closeBtn.TextColor3=Color3.new(1,1,1) end)
  273. saveBtn.MouseButton1Click:Connect(function()
  274. if writefile and messageLbl.Visible==false then
  275. writefile("PizzaFarm.txt",game:GetService("HttpService"):JSONEncode(settings))
  276. messageLbl.Visible=true
  277. wait(2)
  278. messageLbl.Visible=false
  279. end
  280. end)
  281. local cameraArray = {CFrame.new(23,14,65,0.629,0.386,-0.674,-0,0.867,0.497,0.777,-0.313,0.545),CFrame.new(39,15,83,-0.571,0.392,-0.720,-0,0.878,0.478,0.820,0.273,-0.502),CFrame.new(40,20,-38,-0.801,-0.229,0.552,-0,0.923,0.384,-0.598,0.307,-0.739),CFrame.new(51,15,-25,-0.707,0.338,-0.620,0,0.878,0.478,0.707,0.338,-0.620),CFrame.new(47,12,21,0.026,0.323,-0.945,-0,0.946,0.323,0.999,-0.008,0.024)}
  282. local cameraIndex = 0
  283. centerCamBtn.MouseButton1Click:Connect(function()
  284. cameraIndex = 0
  285. workspace.CurrentCamera.CameraType = "Custom"
  286. end)
  287. leftCamBtn.MouseButton1Click:Connect(function()
  288. cameraIndex = cameraIndex - 1
  289. if cameraIndex < 0 then
  290. cameraIndex = #cameraArray
  291. end
  292. if cameraIndex == 0 then
  293. workspace.CurrentCamera.CameraType="Custom"
  294. else
  295. local cf = cameraArray[cameraIndex]
  296. workspace.CurrentCamera.CameraType="Scriptable"
  297. workspace.CurrentCamera:Interpolate(cf,cf+cf.lookVector*10,0.5)
  298. end
  299. end)
  300. rightCamBtn.MouseButton1Click:Connect(function()
  301. cameraIndex = cameraIndex + 1
  302. if cameraIndex > #cameraArray then
  303. cameraIndex = 0
  304. workspace.CurrentCamera.CameraType="Custom"
  305. else
  306. local cf = cameraArray[cameraIndex]
  307. workspace.CurrentCamera.CameraType="Scriptable"
  308. workspace.CurrentCamera:Interpolate(cf,cf+cf.lookVector*10,0.5)
  309. end
  310. end)
  311.  
  312. --//subroutines
  313. local supplyCounts = {TomatoSauce=99,Cheese=99,Sausage=99,Pepperoni=99,Dough=99,Box=99,Dew=99}
  314. for name in pairs(supplyCounts) do
  315. local lbl = workspace.SupplyCounters.Model[name=="Dew" and "CounterMountainDew" or "Counter"..name].a.SG.Counter
  316. supplyCounts[name]=tonumber(lbl.Text)
  317. lbl.Changed:Connect(function()
  318. supplyCounts[name]=tonumber(lbl.Text)
  319. end)
  320. end
  321.  
  322. local function FindFirstCustomer()
  323. local children = workspace.Customers:GetChildren()
  324. for i=1,#children do
  325. local c = children[i]
  326. if ffc(c,"Head") and ffc(c,"Humanoid") and c.Head.CFrame.Z<102 and ffc(c.Head,"Dialog") and ffc(c.Head.Dialog,"Correct") and ((c.Humanoid.SeatPart and c.Humanoid.SeatPart.Anchored) or (c.Humanoid.SeatPart==nil and (c.Head.Velocity.Z^2)^.5<.0001)) then
  327. local dialog = c.Head.Dialog.Correct.ResponseDialog or ''
  328. local order = "MountainDew"
  329. if dialog:sub(-8)=="instead." then
  330. dialog = dialog:sub(-30)
  331. end
  332. if dialog:find("pepperoni",1,true) then
  333. order = "PepperoniPizza"
  334. elseif dialog:find("sausage",1,true) then
  335. order = "SausagePizza"
  336. elseif dialog:find("cheese",1,true) then
  337. order = "CheesePizza"
  338. end
  339. return c,order
  340. end
  341. end
  342. end
  343.  
  344. local boxPtick=0
  345. local boxDtick=0
  346. local function FindBoxes()
  347. local c,o,f
  348. local children = workspace.AllBox:GetChildren()
  349. for i=1,#children do
  350. local b = children[i]
  351. if ffc(b,"HasPizzaInside") or ffc(b,"Pizza") then
  352. if c==nil and b.Name=="BoxClosed" and b.Anchored==false and not b.HasPizzaInside.Value then
  353. c=b
  354. elseif o==nil and b.Name=="BoxOpen" and b.Anchored==false and not b.Pizza.Value then
  355. o=b
  356. elseif f==nil and (b.Name=="BoxOpen" and b.Pizza.Value) or (b.Name=="BoxClosed" and b.HasPizzaInside.Value) then
  357. f=b
  358. end
  359. if c and o and f then
  360. return c,o,f
  361. end
  362. end
  363. end
  364. return c,o,f
  365. end
  366. local function FindBoxingFoods()
  367. local p,d
  368. local children = workspace.BoxingRoom:GetChildren()
  369. for i=1,#children do
  370. local f = children[i]
  371. if not f.Anchored then
  372. if p==nil and f.Name=="Pizza" then
  373. p=f
  374. elseif d==nil and f.Name=="Dew" then
  375. d=f
  376. end
  377. if p and d then
  378. return p,d
  379. end
  380. end
  381. end
  382. return p,d
  383. end
  384.  
  385. local orderDict={["3540529228"]="Cheese",["3540530535"]="Sausage",["3540529917"]="Pepperoni",["2512571151"]="Dew",["2512441325"]="Dew"}
  386. local cookingDict = {Cheese=0,Sausage=0,Pepperoni=0,Dew=0}
  387. local cookPtick=0
  388. local cookDtick=0
  389. local cookWarned=false
  390. local boxerWarned=false
  391. local function getOrders()
  392. local orders={}
  393. local tempCookingDict = {}
  394. for i,v in pairs(cookingDict) do tempCookingDict[i]=v end
  395. local children = workspace.Orders:GetChildren()
  396. for i=1,#children do
  397. local o = orderDict[children[i].SG.ImageLabel.Image:match("%d+$")]
  398. if o then
  399. if tempCookingDict[o]>0 then
  400. --ignores oven pizzas, so new orders are priority
  401. tempCookingDict[o]=tempCookingDict[o]-1
  402. elseif (o=="Dew" and #workspace.AllMountainDew:GetChildren()>0) or (supplyCounts[o]>0 and supplyCounts.TomatoSauce>0 and supplyCounts.Cheese>0) then
  403. --need supplies
  404. orders[#orders+1]=o
  405. end
  406. end
  407. end
  408. return orders
  409. end
  410. local function FindFirstDew()
  411. local children = workspace.AllMountainDew:GetChildren()
  412. for i=1,#children do
  413. local d = children[i]
  414. if (ffc(d,"IsBurned")==nil or d.IsBurned.Value==false) and not d.Anchored then
  415. return d
  416. end
  417. end
  418. end
  419. local function FindBadDew()
  420. local children = workspace.AllMountainDew:GetChildren()
  421. for i=1,#children do
  422. local d = children[i]
  423. if (ffc(d,"IsBurned")==nil or d.IsBurned.Value==false) and d.Position.X > 53 and d.Position.Z > 50 and not d.Anchored then
  424. return d
  425. end
  426. end
  427. end
  428. local function FindDoughAndWithout(str)
  429. local goodraw,p,raw,trash
  430. local children = workspace.AllDough:GetChildren()
  431. for i = #children, 2, -1 do --shuffle
  432. local j = RNG:NextInteger(1, i)
  433. children[j], children[i] = children[i], children[j]
  434. end
  435. for i=1,#children do
  436. local d = children[i]
  437. if d.Anchored==false and #d:GetChildren()>9 then
  438. if d.IsBurned.Value or d.HasBugs.Value or d.Cold.Value or (d.BrickColor.Name=="Bright orange" and ffc(d,"XBillboard")) then
  439. if trash==nil and d.Position.Y > 0 and ((d.Position*Vector3.new(1,0,1))-Vector3.new(47.90, 0, 72.49)).Magnitude > 1 then
  440. trash=d
  441. end
  442. elseif p==nil and d.BrickColor.Name=="Bright orange" then
  443. p=d
  444. elseif goodraw==nil and d.Position.X<55 and d.BrickColor.Name=="Brick yellow" and ((str and not ffc(d.SG.Frame,str)) or (str==nil and ffc(d.SG.Frame,"Sausage")==nil and ffc(d.SG.Frame,"Pepperoni")==nil)) then
  445. --prefers flat
  446. if d.Mesh.Scale.Y<1.1 then
  447. goodraw=d
  448. else
  449. raw=d
  450. end
  451. end
  452. if goodraw and p and trash then
  453. return goodraw,p,trash
  454. end
  455. end
  456. end
  457. return goodraw or raw,p,trash
  458. end
  459. local function getOvenNear(pos)
  460. local children = workspace.Ovens:GetChildren()
  461. for i=1,#children do
  462. if ffc(children[i],"Bottom") and (children[i].Bottom.Position-pos).magnitude < 1.5 then
  463. return children[i]
  464. end
  465. end
  466. end
  467. local function getDoughNear(pos)
  468. local children = workspace.AllDough:GetChildren()
  469. for i=1,#children do
  470. if (children[i].Position-pos).magnitude < 1.5 then
  471. return children[i]
  472. end
  473. end
  474. end
  475. local function isFullyOpen(oven)
  476. return oven.IsOpen.Value==true and (oven.Door.Meter.RotVelocity.Z^2)^.5<.0001
  477. end
  478.  
  479. local bcolorToSupply = {["Dark orange"]="Sausage",["Bright blue"]="Pepperoni",["Bright yellow"]="Cheese",["Bright red"]="TomatoSauce",["Dark green"]="Dew",["Brick yellow"]="Dough",["Light stone grey"]="Box",["Really black"]="Dew"}
  480. local supplyButtons = {}
  481. for i,v in ipairs(workspace.SupplyButtons:GetChildren()) do
  482. supplyButtons[i] = v.Unpressed
  483. end
  484. table.sort(supplyButtons,function(a,b) return a.Position.X < b.Position.X end)
  485. local delTick = 0
  486. local function FindAllDeliveryTools(parent)
  487. local t = {}
  488. local children = parent:GetChildren()
  489. for i=1,#children do
  490. local v = children[i]
  491. if v.ClassName=="Tool" and v.Name:match("^%u%d$") and ffc(v,"Handle") and ffc(v,"House") and (parent~=workspace or (v.Handle.Position-Vector3.new(54.45, 4.02, -16.56)).Magnitude < 30) then
  492. t[#t+1] = v
  493. end
  494. end
  495. return t
  496. end
  497. local function getHousePart(address)
  498. local houses = workspace.Houses:GetChildren()
  499. for i=1,#houses do
  500. local h = houses[i]
  501. if ffc(h,"Address") and h.Address.Value==address and ffc(h,"GivePizza",true) then
  502. return ffc(h,"GivePizza",true)
  503. end
  504. end
  505. end
  506. local function onCharacterAdded(char)
  507. if not char then return end
  508. character=char
  509. root = character:WaitForChild("HumanoidRootPart")
  510. humanoid = character:WaitForChild("Humanoid")
  511. humanoid:SetStateEnabled("FallingDown",false)
  512. end
  513. onCharacterAdded(player.Character or player.CharacterAdded:Wait())
  514. player.CharacterAdded:Connect(onCharacterAdded)
  515.  
  516. local function smoothTP2(cf)
  517. local cf0 = (cf-cf.p) + root.Position + Vector3.new(0,4,0)
  518. local diff = cf.p - root.Position
  519. local oldg = workspace.Gravity
  520. workspace.Gravity = 0
  521. for i=0,diff.Magnitude,0.9 do
  522. humanoid.Sit=false
  523. root.CFrame = cf0 + diff.Unit * i
  524. root.Velocity,root.RotVelocity=Vector3.new(),Vector3.new()
  525. wait()
  526. end
  527. root.CFrame = cf
  528. workspace.Gravity = oldg
  529. end
  530. local function smoothTP(cf)
  531. if (cf.p-root.Position).Magnitude > 95 then
  532. local btns = workspace.JobButtons:GetChildren()
  533. if player:FindFirstChild("House") and player.House.Value then
  534. btns[#btns+1] = player.House.Value:FindFirstChild("Marker")
  535. end
  536. table.sort(btns,function(a,b) return (a.Position-cf.p).Magnitude < (b.Position-cf.p).Magnitude end)
  537. if (btns[1].Position-cf.p).Magnitude < (cf.p-root.Position).Magnitude then
  538. game:GetService("ReplicatedStorage").PlayerChannel:FireServer("TeleportToJob", ((btns[1].Name == "Marker") and "House" or btns[1].Name))
  539. wait(0.7)
  540. if (cf.p-root.Position).Magnitude < 8 then
  541. return
  542. end
  543. end
  544. end
  545. smoothTP2(cf)
  546. end
  547. for _,o in ipairs(workspace.Ovens:GetChildren()) do
  548. if ffc(o,"Bottom") then
  549. o.Bottom.CanTouch = false
  550. end
  551. end
  552. local function tryCook()
  553. for zz=1,18 do
  554. local order = getOrders()[1]
  555. local topping
  556. if order=="Pepperoni" or order=="Sausage" then topping=order end
  557. local cookD = FindFirstDew()
  558. local badD = FindBadDew()
  559. local raw,cookP,trash
  560. if topping then
  561. --pepperoni order avoids sausage dough and vice verca
  562. raw,cookP,trash = FindDoughAndWithout(topping=="Pepperoni" and "Sausage" or "Pepperoni")
  563. else
  564. raw,cookP,trash = FindDoughAndWithout()
  565. end
  566. local ovens = workspace.Ovens:GetChildren()
  567. for i=#ovens,1,-1 do
  568. if #ovens[i]:GetChildren() < 10 then
  569. table.remove(ovens,i)
  570. end
  571. end
  572. for i = #ovens, 2, -1 do --shuffle
  573. local j = RNG:NextInteger(1, i)
  574. ovens[j], ovens[i] = ovens[i], ovens[j]
  575. end
  576. if doCook then
  577. local didsomething=false
  578. --move final pizza
  579. if cookP and tick()-cookPtick>0.8 then
  580. local oven = getOvenNear(cookP.Position)
  581. if oven==nil or oven.IsOpen.Value then
  582. cookPtick=tick()
  583. didsomething=true
  584. if (root.Position-Vector3.new(36.64, 3.80, 54.11)).magnitude>9 then smoothTP(CFrame.new(36.64, 3.80, 54.11)) wait(.1) end
  585. network:FireServer("UpdateProperty", cookP, "CFrame", CFrame.new(RNG:NextNumber(56,57),4.1,38))
  586. end
  587. end
  588. if order then
  589. if order=="Dew" and cookD and tick()-cookDtick>0.8 then
  590. --move dew if ordered
  591. cookDtick=tick()
  592. didsomething=true
  593. if (root.Position-Vector3.new(36.64, 3.80, 54.11)).magnitude>9 then smoothTP(CFrame.new(36.64, 3.80, 54.11)) wait(.1) end
  594. network:FireServer("UpdateProperty", cookD, "CFrame", CFrame.new(53,4.68,36.5))
  595. elseif order~="Dew" and raw and raw.Parent and supplyCounts[order]>0 and supplyCounts.TomatoSauce>0 and supplyCounts.Cheese>0 then
  596. --make pizza
  597. if raw.Mesh.Scale.Y>1.5 then
  598. if (root.Position-Vector3.new(36.64, 3.80, 54.11)).magnitude>9 then smoothTP(CFrame.new(36.64, 3.80, 54.11)) wait(.1) end
  599. didsomething=true
  600. network:FireServer("UpdateProperty", raw, "CFrame", CFrame.new(RNG:NextNumber(29.6,44.6),3.7,RNG:NextNumber(42.5,48.5)))
  601. wait()
  602. network:FireServer("SquishDough", raw)
  603. else
  604. --make sure it will have an oven
  605. local oven
  606. for _,o in ipairs(ovens) do
  607. if isFullyOpen(o) then
  608. local other = getDoughNear(o.Bottom.Position)
  609. if other==nil or not (other.BrickColor.Name=="Bright orange" and ffc(other.SG.Frame,"TomatoSauce") and ffc(other.SG.Frame,"MeltedCheese")) then
  610. if other then
  611. --replace mistaken dough
  612. didsomething=true
  613. if (root.Position-Vector3.new(36.64, 3.80, 54.11)).magnitude>9 then smoothTP(CFrame.new(36.64, 3.80, 54.11)) wait(.1) end
  614. network:FireServer("UpdateProperty", other, "CFrame", CFrame.new(RNG:NextNumber(29.6,44.6),3.7,RNG:NextNumber(42.5,48.5)))
  615. wait()
  616. end
  617. oven=o
  618. break
  619. end
  620. end
  621. end
  622. if oven and raw.Parent==workspace.AllDough then
  623. --make
  624. if (root.Position-Vector3.new(36.64, 3.80, 54.11)).magnitude>9 then smoothTP(CFrame.new(36.64, 3.80, 54.11)) wait(.1) end
  625. didsomething=true
  626. network:FireServer("AddIngredientToPizza", raw,"TomatoSauce")
  627. network:FireServer("AddIngredientToPizza", raw,"Cheese")
  628. network:FireServer("AddIngredientToPizza", raw,topping)
  629. network:FireServer("UpdateProperty", raw, "CFrame", oven.Bottom.CFrame+Vector3.new(0,0.7,0))
  630. oven.Door.ClickDetector.Detector:FireServer()
  631. --mark as cooking
  632. cookingDict[order]=cookingDict[order]+1
  633. local revoked=false
  634. spawn(function()
  635. raw.AncestryChanged:Wait()
  636. if not revoked then
  637. cookingDict[order]=cookingDict[order]-1
  638. revoked=true
  639. end
  640. end)
  641. delay(40, function()
  642. if not revoked then
  643. cookingDict[order]=cookingDict[order]-1
  644. revoked=true
  645. end
  646. end)
  647. end
  648. end
  649. end
  650. end
  651. --open unnecessarily closed ovens
  652. for _,o in ipairs(ovens) do
  653. local bar = o.Door.Meter.SurfaceGui.ProgressBar.Bar
  654. if o.IsOpen.Value==false and (o.IsCooking.Value==false or (Vector3.new(bar.ImageColor3.r,bar.ImageColor3.g,bar.ImageColor3.b)-Vector3.new(.871,.518,.224)).magnitude>.1) then
  655. didsomething=true
  656. if (root.Position-Vector3.new(36.64, 3.80, 54.11)).magnitude>9 then smoothTP(CFrame.new(36.64, 3.80, 54.11)) wait(.1) end
  657. o.Door.ClickDetector.Detector:FireServer()
  658. break
  659. end
  660. end
  661. --trash
  662. if badD then
  663. didsomething=true
  664. if (root.Position-Vector3.new(36.64, 3.80, 54.11)).magnitude>9 then smoothTP(CFrame.new(36.64, 3.80, 54.11)) wait(.1) end
  665. network:FireServer("UpdateProperty", badD, "CFrame", CFrame.new(RNG:NextNumber(28,30), 1.7, RNG:NextNumber(55,57)))
  666. end
  667. if trash and (trash.IsBurned.Value==false or getOvenNear(trash.Position)==nil or getOvenNear(trash.Position).IsOpen.Value) then
  668. --closed oven breaks if you take burnt out of it
  669. didsomething=true
  670. if (root.Position-Vector3.new(36.64, 3.80, 54.11)).magnitude>9 then smoothTP(CFrame.new(36.64, 3.80, 54.11)) wait(.1) end
  671. network:FireServer("UpdateProperty", trash, "CFrame", CFrame.new(47.90, 7.00, 72.49, 1, 0, -0, 0, 0, 1, 0, -1, 0))
  672. end
  673. if didsomething then wait(0.5) else break end
  674. else
  675. break
  676. end
  677. end
  678. end
  679. wait(1)
  680. --//main loop
  681. while gui.Parent do
  682. wait(0.9)
  683. humanoid.Sit=false
  684. if RNG:NextInteger(1,20)==1 then
  685. game:GetService("VirtualInputManager"):SendKeyEvent(true,"Z",false,game)
  686. wait()
  687. game:GetService("VirtualInputManager"):SendKeyEvent(false,"Z",false,game)
  688. end
  689. for zz=1,3 do
  690. local c,order = FindFirstCustomer()
  691. if doCashier and c and order then
  692. local reg = 3
  693. if c.Head.Position.X < 50 then
  694. reg = 2
  695. elseif c.Head.Position.X < 70 then
  696. reg = 1
  697. end
  698. if (root.Position-Vector3.new(50.30, 3.80, 83.24)).magnitude>9 then smoothTP(CFrame.new(50.30, 3.80, 83.24)) wait(.1) end
  699. network:FireServer("OrderComplete", c, order, workspace["Register"..reg])
  700. wait(0.3)
  701. else
  702. break
  703. end
  704. end
  705. tryCook()
  706. for zz=1,7 do
  707. if doBoxer then
  708. local didsomething = false
  709. local boxP,boxD = FindBoxingFoods()
  710. local closedBox,openBox,fullBox = FindBoxes()
  711. if boxD and tick()-boxDtick>0.8 then
  712. boxDtick=tick()
  713. didsomething=true
  714. if (root.Position-Vector3.new(58.74, 3.80, 12.400)).magnitude>9 then smoothTP(CFrame.new(58.74, 3.80, 12.40))wait(.1) continue end
  715. network:FireServer("UpdateProperty", boxD, "CFrame", CFrame.new(63,4.9,-1,-1,0,0,0,1,0,0,0,-1))
  716. end
  717. if fullBox then
  718. if fullBox.Name=="BoxOpen" then
  719. didsomething=true
  720. if (root.Position-Vector3.new(58.74, 3.80, 12.400)).magnitude>9 then smoothTP(CFrame.new(58.74, 3.80, 12.40))wait(.1) continue end
  721. network:FireServer("CloseBox", fullBox)
  722. --will be moved next loop
  723. elseif tick()-boxPtick>0.8 then
  724. didsomething=true
  725. if (root.Position-Vector3.new(58.74, 3.80, 12.400)).magnitude>9 then smoothTP(CFrame.new(58.74, 3.80, 12.40))wait(.1) continue end
  726. network:FireServer("UpdateProperty", fullBox, "CFrame", CFrame.new(68.2,4.4,RNG:NextNumber(-3,-2),-1,0,0,0,1,0,0,0,-1))
  727. boxPtick=tick()
  728. end
  729. end
  730. if closedBox and not openBox then
  731. didsomething=true
  732. if (root.Position-Vector3.new(58.74, 3.80, 12.400)).magnitude>9 then smoothTP(CFrame.new(58.74, 3.80, 12.40))wait(.1) continue end
  733. network:FireServer("UpdateProperty", closedBox, "CFrame", CFrame.new(RNG:NextNumber(62.5,70.5),3.5,RNG:NextNumber(11,25)))
  734. wait()
  735. network:FireServer("OpenBox", closedBox)
  736. end
  737. if openBox and boxP then
  738. didsomething=true
  739. if (root.Position-Vector3.new(58.74, 3.80, 12.400)).magnitude>9 then smoothTP(CFrame.new(58.74, 3.80, 12.40))wait(.1) continue end
  740. network:FireServer("UpdateProperty", boxP, "Anchored", true)
  741. network:FireServer("UpdateProperty", openBox, "Anchored", true)
  742. wait()
  743. network:FireServer("UpdateProperty", boxP, "CFrame", openBox.CFrame+Vector3.new(0,-2,0))
  744. wait()
  745. network:FireServer("AssignPizzaToBox", openBox, boxP)
  746. end
  747. if didsomething then wait(0.5) else break end
  748. else
  749. break
  750. end
  751. end
  752. if doDelivery then
  753. local wstools = FindAllDeliveryTools(workspace)
  754. if #wstools > 1 or (wstools[1] and ffc(wstools[1].Handle,"X10")) then
  755. --get tools
  756. if (root.Position-Vector3.new(54.45, 4.02, -15)).magnitude>9 then smoothTP(CFrame.new(54.45, 4.02, -15)) wait(.1) end
  757. for i=1,#wstools do
  758. if wstools[i].Parent == workspace then
  759. humanoid:EquipTool(wstools[i])
  760. wait()
  761. end
  762. end
  763. wait(0.3)
  764. local t = FindAllDeliveryTools(character)
  765. for i=1,#t do
  766. t[i].Parent = player.Backpack
  767. end
  768. wait(0.1)
  769. if ffc(character,"RightHand") and ffc(character.RightHand,"RightGrip") then
  770. character.RightHand.RightGrip:Destroy()
  771. end
  772. end
  773. local bptools = FindAllDeliveryTools(player.Backpack)
  774. if #bptools >= settings.deliver_at and #bptools > 0 and tick()-delTick > 30 then
  775. --deliver to houses
  776. table.sort(bptools,function(a,b)
  777. a,b=tostring(a),tostring(b)
  778. if (a:sub(1,1)=="B" and b:sub(1,1)=="B") then
  779. return a < b
  780. end
  781. return a > b
  782. end)
  783. local fatass=false
  784. for i=1,#bptools do
  785. if not doDelivery then
  786. break
  787. end
  788. humanoid.Sit=false
  789. local tool = bptools[i]
  790. local giver = getHousePart(tool.Name)
  791. local ogp = giver.Position
  792. if giver then
  793. if (giver.Position-root.Position).Magnitude > 9 then
  794. smoothTP(giver.CFrame+Vector3.new(0,7,0))
  795. if giver.Parent==nil or (giver.Position-ogp).Magnitude>1 then
  796. giver = getHousePart(tool.Name) or giver
  797. smoothTP(giver.CFrame+Vector3.new(0,7,0))
  798. end
  799. pcall(function() tool.Parent = character end)
  800. wait(1.2)
  801. local t = FindAllDeliveryTools(character)
  802. for i=1,#t do
  803. if t[i] ~= tool then
  804. t[i].Parent = player.Backpack
  805. end
  806. end
  807. wait(2)
  808. fatass=false
  809. else
  810. if fatass then
  811. wait(0.2)
  812. else
  813. wait(0.7)
  814. end
  815. pcall(function() tool.Parent = character end)
  816. wait()
  817. fatass=true
  818. end
  819. end
  820. end
  821. delTick = tick()
  822. end
  823. end
  824. tryCook()
  825. if doSupplier then
  826. local refill=false
  827. for s,c in pairs(supplyCounts) do
  828. if c <= settings.refill_at then
  829. refill=true
  830. break
  831. end
  832. end
  833. if refill then
  834. local oldcf = root.CFrame
  835. local waiting = false
  836. local waitingTick = 0
  837. local lastBox
  838. while doSupplier do
  839. --check if refill is done otherwise hit buttons
  840. local fulfilled=true
  841. local boxes = workspace.AllSupplyBoxes:GetChildren()
  842. for yy=1,2 do
  843. local needtp=true
  844. local realc = 0
  845. for _,btn in ipairs(supplyButtons) do
  846. local s = bcolorToSupply[btn.BrickColor.Name]
  847. if supplyCounts[s] < settings.refill_end then
  848. local count = 0
  849. if #boxes > 30 then
  850. for i=1,#boxes do
  851. local box = boxes[i]
  852. if bcolorToSupply[box.BrickColor.Name]==s and box.Anchored==false and box.Position.Z < -940 then
  853. count=count+1
  854. end
  855. end
  856. end
  857. if count < 2 then
  858. if needtp then
  859. needtp=false
  860. smoothTP(btn.CFrame + Vector3.new(0,3,2.5))
  861. wait(0.1)
  862. end
  863. if not doSupplier then break end
  864. root.CFrame = btn.CFrame + Vector3.new(0,3,0)
  865. wait(0.1)
  866. realc=realc+1
  867. end
  868. fulfilled=false
  869. end
  870. end
  871. wait(0.2)
  872. if yy == 1 and realc < 3 then
  873. wait(0.6)
  874. end
  875. end
  876. if fulfilled or not (doSupplier) then
  877. break
  878. end
  879. smoothTP(CFrame.new(8,12.4,-1020))
  880. if not doSupplier then break end
  881. --check if can finish waiting for boxes to move
  882. if waiting and (lastBox.Position.X>42 or tick()-waitingTick>6) then
  883. waiting=false
  884. if lastBox.Position.X<42 then
  885. --clear boxes if stuck
  886. smoothTP(CFrame.new(20.5,8,-35))
  887. wait(0.1)
  888. local boxes = workspace.AllSupplyBoxes:GetChildren()
  889. for i=1,#boxes do
  890. local box = boxes[i]
  891. if box.Anchored==false and box.Position.Z>-55 then
  892. network:FireServer("UpdateProperty", box, "CFrame", CFrame.new(RNG:NextNumber(0,40),RNG:NextNumber(-10,-30),-70))
  893. wait()
  894. end
  895. end
  896. wait(0.1)
  897. end
  898. end
  899. if not waiting then
  900. --move boxes
  901. if root.Position.Z > -900 then smoothTP(CFrame.new(8,12.4,-1020)) end
  902. wait(0.1)
  903. lastBox=nil
  904. local j=0
  905. local boxes = workspace.AllSupplyBoxes:GetChildren()
  906. for i=1,#boxes do
  907. local box = boxes[i]
  908. if box.Anchored==false and box.Position.Z < -940 and bcolorToSupply[box.BrickColor.Name] and supplyCounts[bcolorToSupply[box.BrickColor.Name]]<settings.refill_end then
  909. box.CFrame = CFrame.new(38-4.3*math.floor(j/2),5,-7-5*(j%2))
  910. network:FireServer("UpdateProperty", box, "CFrame", box.CFrame)
  911. lastBox=box
  912. j=j+1
  913. if j>13 then break end
  914. end
  915. end
  916. if lastBox then
  917. waiting=true
  918. waitingTick=tick()
  919. end
  920. end
  921. end
  922. --smoothTP(oldcf)
  923. end
  924. end
  925. end
Advertisement
Comments
  • Gaggirl1234
    201 days
    # text 0.17 KB | 0 0
    1. The supplier and cook seems to have trouble after the christmas update, supplier just gets stuck at sausage button and the cook only makes pizza and doesn't put any soda
Add Comment
Please, Sign In to add comment
Advertisement