Advertisement
MaxproGlitcher

Untitled

Dec 4th, 2022
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.21 KB | None | 0 0
  1. -- updated by MaxproGlitcher#6199 originally made by serilKilla
  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).script) == "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[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. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = cf
  532. end
  533. for _,o in ipairs(workspace.Ovens:GetChildren()) do
  534. if ffc(o,"Bottom") then
  535. o.Bottom.CanTouch = false
  536. end
  537. end
  538. local function tryCook()
  539. for zz=1,18 do
  540. local order = getOrders()[1]
  541. local topping
  542. if order=="Pepperoni" or order=="Sausage" then topping=order end
  543. local cookD = FindFirstDew()
  544. local badD = FindBadDew()
  545. local raw,cookP,trash
  546. if topping then
  547. --pepperoni order avoids sausage dough and vice verca
  548. raw,cookP,trash = FindDoughAndWithout(topping=="Pepperoni" and "Sausage" or "Pepperoni")
  549. else
  550. raw,cookP,trash = FindDoughAndWithout()
  551. end
  552. local ovens = workspace.Ovens:GetChildren()
  553. for i=#ovens,1,-1 do
  554. if #ovens[i]:GetChildren() < 10 then
  555. table.remove(ovens,i)
  556. end
  557. end
  558. for i = #ovens, 2, -1 do --shuffle
  559. local j = RNG:NextInteger(1, i)
  560. ovens[j], ovens[i] = ovens[i], ovens[j]
  561. end
  562. if doCook then
  563. local didsomething=false
  564. --move final pizza
  565. if cookP and tick()-cookPtick>0.8 then
  566. local oven = getOvenNear(cookP.Position)
  567. if oven==nil or oven.IsOpen.Value then
  568. cookPtick=tick()
  569. didsomething=true
  570. 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
  571. network:FireServer("UpdateProperty", cookP, "CFrame", CFrame.new(RNG:NextNumber(56,57),4.1,38))
  572. end
  573. end
  574. if order then
  575. if order=="Dew" and cookD and tick()-cookDtick>0.8 then
  576. --move dew if ordered
  577. cookDtick=tick()
  578. didsomething=true
  579. 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
  580. network:FireServer("UpdateProperty", cookD, "CFrame", CFrame.new(53,4.68,36.5))
  581. elseif order~="Dew" and raw and raw.Parent and supplyCounts[order]>0 and supplyCounts.TomatoSauce>0 and supplyCounts.Cheese>0 then
  582. --make pizza
  583. if raw.Mesh.Scale.Y>1.5 then
  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. didsomething=true
  586. network:FireServer("UpdateProperty", raw, "CFrame", CFrame.new(RNG:NextNumber(29.6,44.6),3.7,RNG:NextNumber(42.5,48.5)))
  587. wait()
  588. network:FireServer("SquishDough", raw)
  589. else
  590. --make sure it will have an oven
  591. local oven
  592. for _,o in ipairs(ovens) do
  593. if isFullyOpen(o) then
  594. local other = getDoughNear(o.Bottom.Position)
  595. if other==nil or not (other.BrickColor.Name=="Bright orange" and ffc(other.SG.Frame,"TomatoSauce") and ffc(other.SG.Frame,"MeltedCheese")) then
  596. if other then
  597. --replace mistaken dough
  598. didsomething=true
  599. 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
  600. network:FireServer("UpdateProperty", other, "CFrame", CFrame.new(RNG:NextNumber(29.6,44.6),3.7,RNG:NextNumber(42.5,48.5)))
  601. wait()
  602. end
  603. oven=o
  604. break
  605. end
  606. end
  607. end
  608. if oven and raw.Parent==workspace.AllDough then
  609. --make
  610. 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
  611. didsomething=true
  612. network:FireServer("AddIngredientToPizza", raw,"TomatoSauce")
  613. network:FireServer("AddIngredientToPizza", raw,"Cheese")
  614. network:FireServer("AddIngredientToPizza", raw,topping)
  615. network:FireServer("UpdateProperty", raw, "CFrame", oven.Bottom.CFrame+Vector3.new(0,0.7,0))
  616. oven.Door.ClickDetector.Detector:FireServer()
  617. --mark as cooking
  618. cookingDict[order]=cookingDict[order]+1
  619. local revoked=false
  620. spawn(function()
  621. raw.AncestryChanged:Wait()
  622. if not revoked then
  623. cookingDict[order]=cookingDict[order]-1
  624. revoked=true
  625. end
  626. end)
  627. delay(40, function()
  628. if not revoked then
  629. cookingDict[order]=cookingDict[order]-1
  630. revoked=true
  631. end
  632. end)
  633. end
  634. end
  635. end
  636. end
  637. --open unnecessarily closed ovens
  638. for _,o in ipairs(ovens) do
  639. local bar = o.Door.Meter.SurfaceGui.ProgressBar.Bar
  640. 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
  641. didsomething=true
  642. 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
  643. o.Door.ClickDetector.Detector:FireServer()
  644. break
  645. end
  646. end
  647. --trash
  648. if badD then
  649. didsomething=true
  650. 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
  651. network:FireServer("UpdateProperty", badD, "CFrame", CFrame.new(RNG:NextNumber(28,30), 1.7, RNG:NextNumber(55,57)))
  652. end
  653. if trash and (trash.IsBurned.Value==false or getOvenNear(trash.Position)==nil or getOvenNear(trash.Position).IsOpen.Value) then
  654. --closed oven breaks if you take burnt out of it
  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. network:FireServer("UpdateProperty", trash, "CFrame", CFrame.new(47.90, 7.00, 72.49, 1, 0, -0, 0, 0, 1, 0, -1, 0))
  658. end
  659. if didsomething then wait(0.5) else break end
  660. else
  661. break
  662. end
  663. end
  664. end
  665. wait(1)
  666. --//main loop
  667. while gui.Parent do
  668. wait(0.9)
  669. humanoid.Sit=false
  670. if RNG:NextInteger(1,20)==1 then
  671. game:GetService("VirtualInputManager"):SendKeyEvent(true,"Z",false,game)
  672. wait()
  673. game:GetService("VirtualInputManager"):SendKeyEvent(false,"Z",false,game)
  674. end
  675. for zz=1,3 do
  676. local c,order = FindFirstCustomer()
  677. if doCashier and c and order then
  678. local reg = 3
  679. if c.Head.Position.X < 50 then
  680. reg = 2
  681. elseif c.Head.Position.X < 70 then
  682. reg = 1
  683. end
  684. 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
  685. network:FireServer("OrderComplete", c, order, workspace["Register"..reg])
  686. wait(0.3)
  687. else
  688. break
  689. end
  690. end
  691. tryCook()
  692. for zz=1,7 do
  693. if doBoxer then
  694. local didsomething = false
  695. local boxP,boxD = FindBoxingFoods()
  696. local closedBox,openBox,fullBox = FindBoxes()
  697. if boxD and tick()-boxDtick>0.8 then
  698. boxDtick=tick()
  699. didsomething=true
  700. 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
  701. network:FireServer("UpdateProperty", boxD, "CFrame", CFrame.new(63,4.9,-1,-1,0,0,0,1,0,0,0,-1))
  702. end
  703. if fullBox then
  704. if fullBox.Name=="BoxOpen" then
  705. didsomething=true
  706. 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
  707. network:FireServer("CloseBox", fullBox)
  708. --will be moved next loop
  709. elseif tick()-boxPtick>0.8 then
  710. didsomething=true
  711. 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
  712. network:FireServer("UpdateProperty", fullBox, "CFrame", CFrame.new(68.2,4.4,RNG:NextNumber(-3,-2),-1,0,0,0,1,0,0,0,-1))
  713. boxPtick=tick()
  714. end
  715. end
  716. if closedBox and not openBox then
  717. didsomething=true
  718. 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
  719. network:FireServer("UpdateProperty", closedBox, "CFrame", CFrame.new(RNG:NextNumber(62.5,70.5),3.5,RNG:NextNumber(11,25)))
  720. wait()
  721. network:FireServer("OpenBox", closedBox)
  722. end
  723. if openBox and boxP 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", boxP, "Anchored", true)
  727. network:FireServer("UpdateProperty", openBox, "Anchored", true)
  728. wait()
  729. network:FireServer("UpdateProperty", boxP, "CFrame", openBox.CFrame+Vector3.new(0,-2,0))
  730. wait()
  731. network:FireServer("AssignPizzaToBox", openBox, boxP)
  732. end
  733. if didsomething then wait(0.5) else break end
  734. else
  735. break
  736. end
  737. end
  738. if doDelivery then
  739. local wstools = FindAllDeliveryTools(workspace)
  740. if #wstools > 1 or (wstools[1] and ffc(wstools[1].Handle,"X10")) then
  741. --get tools
  742. if (root.Position-Vector3.new(54.45, 4.02, -15)).magnitude>9 then smoothTP(CFrame.new(54.45, 4.02, -15)) wait(.1) end
  743. for i=1,#wstools do
  744. if wstools[i].Parent == workspace then
  745. humanoid:EquipTool(wstools[i])
  746. wait()
  747. end
  748. end
  749. wait(0.3)
  750. local t = FindAllDeliveryTools(character)
  751. for i=1,#t do
  752. t[i].Parent = player.Backpack
  753. end
  754. wait(0.1)
  755. if ffc(character,"RightHand") and ffc(character.RightHand,"RightGrip") then
  756. character.RightHand.RightGrip:Destroy()
  757. end
  758. end
  759. local bptools = FindAllDeliveryTools(player.Backpack)
  760. if #bptools >= settings.deliver_at and #bptools > 0 and tick()-delTick > 30 then
  761. --deliver to houses
  762. table.sort(bptools,function(a,b)
  763. a,b=tostring(a),tostring(b)
  764. if (a:sub(1,1)=="B" and b:sub(1,1)=="B") then
  765. return a < b
  766. end
  767. return a > b
  768. end)
  769. local fatass=false
  770. for i=1,#bptools do
  771. if not doDelivery then
  772. break
  773. end
  774. humanoid.Sit=false
  775. local tool = bptools[i]
  776. local giver = getHousePart(tool.Name)
  777. local ogp = giver.Position
  778. if giver then
  779. if (giver.Position-root.Position).Magnitude > 9 then
  780. smoothTP(giver.CFrame+Vector3.new(0,7,0))
  781. if giver.Parent==nil or (giver.Position-ogp).Magnitude>1 then
  782. giver = getHousePart(tool.Name) or giver
  783. smoothTP(giver.CFrame+Vector3.new(0,7,0))
  784. end
  785. pcall(function() tool.Parent = character end)
  786. wait(1.2)
  787. local t = FindAllDeliveryTools(character)
  788. for i=1,#t do
  789. if t[i] ~= tool then
  790. t[i].Parent = player.Backpack
  791. end
  792. end
  793. wait(2)
  794. fatass=false
  795. else
  796. if fatass then
  797. wait(0.2)
  798. else
  799. wait(0.7)
  800. end
  801. pcall(function() tool.Parent = character end)
  802. wait()
  803. fatass=true
  804. end
  805. end
  806. end
  807. delTick = tick()
  808. end
  809. end
  810. tryCook()
  811. if doSupplier then
  812. local refill=false
  813. for s,c in pairs(supplyCounts) do
  814. if c <= settings.refill_at then
  815. refill=true
  816. break
  817. end
  818. end
  819. if refill then
  820. local oldcf = root.CFrame
  821. local waiting = false
  822. local waitingTick = 0
  823. local lastBox
  824. while doSupplier do
  825. --check if refill is done otherwise hit buttons
  826. local fulfilled=true
  827. local boxes = workspace.AllSupplyBoxes:GetChildren()
  828. for yy=1,2 do
  829. local needtp=true
  830. local realc = 0
  831. for _,btn in ipairs(supplyButtons) do
  832. local s = bcolorToSupply[btn.BrickColor.Name]
  833. if supplyCounts[s] < settings.refill_end then
  834. local count = 0
  835. if #boxes > 30 then
  836. for i=1,#boxes do
  837. local box = boxes[i]
  838. if bcolorToSupply[box.BrickColor.Name]==s and box.Anchored==false and box.Position.Z < -940 then
  839. count=count+1
  840. end
  841. end
  842. end
  843. if count < 2 then
  844. if needtp then
  845. needtp=false
  846. smoothTP(btn.CFrame + Vector3.new(0,3,2.5))
  847. wait(0.1)
  848. end
  849. if not doSupplier then break end
  850. root.CFrame = btn.CFrame + Vector3.new(0,3,0)
  851. wait(0.1)
  852. realc=realc+1
  853. end
  854. fulfilled=false
  855. end
  856. end
  857. wait(0.2)
  858. if yy == 1 and realc < 3 then
  859. wait(0.6)
  860. end
  861. end
  862. if fulfilled or not (doSupplier) then
  863. break
  864. end
  865. smoothTP(CFrame.new(8,12.4,-1020))
  866. if not doSupplier then break end
  867. --check if can finish waiting for boxes to move
  868. if waiting and (lastBox.Position.X>42 or tick()-waitingTick>6) then
  869. waiting=false
  870. if lastBox.Position.X<42 then
  871. --clear boxes if stuck
  872. smoothTP(CFrame.new(20.5,8,-35))
  873. wait(0.1)
  874. local boxes = workspace.AllSupplyBoxes:GetChildren()
  875. for i=1,#boxes do
  876. local box = boxes[i]
  877. if box.Anchored==false and box.Position.Z>-55 then
  878. network:FireServer("UpdateProperty", box, "CFrame", CFrame.new(RNG:NextNumber(0,40),RNG:NextNumber(-10,-30),-70))
  879. wait()
  880. end
  881. end
  882. wait(0.1)
  883. end
  884. end
  885. if not waiting then
  886. --move boxes
  887. if root.Position.Z > -900 then smoothTP(CFrame.new(8,12.4,-1020)) end
  888. wait(0.1)
  889. lastBox=nil
  890. local j=0
  891. local boxes = workspace.AllSupplyBoxes:GetChildren()
  892. for i=1,#boxes do
  893. local box = boxes[i]
  894. if box.Anchored==false and box.Position.Z < -940 and bcolorToSupply[box.BrickColor.Name] and supplyCounts[bcolorToSupply[box.BrickColor.Name]]<settings.refill_end then
  895. box.CFrame = CFrame.new(38-4.3*math.floor(j/2),5,-7-5*(j%2))
  896. network:FireServer("UpdateProperty", box, "CFrame", box.CFrame)
  897. lastBox=box
  898. j=j+1
  899. if j>13 then break end
  900. end
  901. end
  902. if lastBox then
  903. waiting=true
  904. waitingTick=tick()
  905. end
  906. end
  907. end
  908. --smoothTP(oldcf)
  909. end
  910. end
  911. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement