Advertisement
Hellotop2

Untitled

Mar 1st, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 33.38 KB | None | 0 0
  1. local getupv, setupv = getupvalue or debug.getupvalue, setupvalue or debug.setupvalue
  2. if not (getrawmetatable and getupv and setupv and (getreg or debug.getregistry)) then
  3. local h = Instance.new("Hint",workspace)
  4. h.Text = "Incompatible exploit."
  5. wait(2)
  6. h:Destroy()
  7. return
  8. end
  9. local settings = {cashier=true, boxer=true, cook=true, supplier=true, delivery=true, refill_at=50, refill_end=97, stay_in_kitchen=true}
  10. if readfile then
  11. pcall(function()
  12. local new = game:GetService("HttpService"):JSONDecode(readfile("PizzaFarm.txt"))
  13. --corruption?
  14. local doOverwrite=false
  15. for k,v in pairs(new) do
  16. if settings[k]==nil then
  17. doOverwrite=true
  18. new[k]=nil
  19. end
  20. end
  21. for k,v in pairs(settings) do
  22. if new[k]==nil then
  23. doOverwrite=true
  24. new[k]=v
  25. end
  26. end
  27. --use input
  28. if doOverwrite then
  29. warn("Settings overwritten")
  30. writefile("PizzaFarm.txt",game:GetService("HttpService"):JSONEncode(new))
  31. end
  32. settings = new
  33. end)
  34. end
  35.  
  36. local player = game:GetService("Players").LocalPlayer
  37. local ffc = game.FindFirstChild
  38. local RNG = Random.new()
  39. local remoteKey
  40. local character,root
  41. do
  42. local reg = (getreg or debug.getregistry)()
  43. for i=1,#reg do
  44. local v = reg[i]
  45. if type(v)=="function" and getupv(v,"decision") and getfenv(v).script.Name=="WorkTool" then
  46. remoteKey = getupv(v,"decision")
  47. break
  48. end
  49. end
  50. for i=1,#reg do
  51. local v=reg[i]
  52. if type(v)=="function" and getupv(v,"CashOut") and getfenv(v).script.Name=="Paycheck" then
  53. setupv(v,"CashOut",{MouseButton1Click={wait=function() end,Wait=function() end}})
  54. break
  55. end
  56. end
  57. local mt=getrawmetatable(game)
  58. if setreadonly then
  59. setreadonly(mt,false)
  60. elseif make_writeable then
  61. make_writeable(mt)
  62. end
  63. local oldNewindex=mt.__newindex
  64. if newcclosure then
  65. mt.__newindex=newcclosure(function(t,k,v)
  66. if t~=workspace.CurrentCamera or getfenv(2).script.Name~="LocalMain" then
  67. return oldNewindex(t,k,v)
  68. end
  69. end)
  70. else
  71. mt.__newindex=function(t,k,v)
  72. if t~=workspace.CurrentCamera or getfenv(2).script.Name~="LocalMain" then
  73. return oldNewindex(t,k,v)
  74. end
  75. end
  76. end
  77. workspace.Main.RealignCamera.RealignCamera:Destroy()
  78. Instance.new("BindableEvent",workspace.Main.RealignCamera).Name="RealignCamera"
  79. end
  80. assert(remoteKey,"failed to find remoteKey")
  81. --//gui
  82. Create = function(class,parent,props)
  83. local new = Instance.new(class)
  84. for k,v in next,props do
  85. new[k]=v
  86. end
  87. new.Parent = parent
  88. return new
  89. end
  90. gui=Create("ScreenGui",game.CoreGui,{Name="Farm", ZIndexBehavior="Sibling"})
  91. main=Create("Frame",gui,{Name="main", Draggable=true, Active=true, Size=UDim2.new(0,500,0,170), Position=UDim2.new(.335,0,0.02,0), BackgroundColor3=Color3.new(0.098,0.098,0.098)})
  92. topbar=Create("Frame",main,{Name="topbar", Size=UDim2.new(1,0,0.1,0), BackgroundColor3=Color3.new(0.255,0.255,0.255)})
  93. 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,
  94. Font="GothamSemibold", Position=UDim2.new(0.96,0,0,0), TextSize=14, TextScaled=true, BackgroundColor3=Color3.new(1,1,1)})
  95. titleLbl=Create("TextLabel",topbar,{Name="titleLbl", TextWrapped=true, Size=UDim2.new(0.5,0,1,0), Text="Pizza Factory", TextSize=14, Font="GothamSemibold",
  96. BackgroundTransparency=1, Position=UDim2.new(0.25,0,0,0), TextColor3=Color3.new(1,1,1), BackgroundColor3=Color3.new(1,1,1)})
  97. 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})
  98. settings_1=Create("Frame",main,{Name="settings", BackgroundTransparency=1, Size=UDim2.new(0.97,0,0.8,0), Position=UDim2.new(0.025,0,0.15,0), BackgroundColor3=Color3.new(1,1,1)})
  99. Layout=Create("UIGridLayout",settings_1,{VerticalAlignment="Center", SortOrder="LayoutOrder", HorizontalAlignment="Center", CellPadding=UDim2.new(0.045,0,0.15,0), CellSize=UDim2.new(0.303,0,0.2,0)})
  100. cashier=Create("Frame",settings_1,{Name="cashier", LayoutOrder=4, BackgroundTransparency=1, Size=UDim2.new(0,100,0,100), BackgroundColor3=Color3.new(1,1,1)})
  101. Label=Create("TextLabel",cashier,{TextWrapped=true, Size=UDim2.new(0.6,0,1,0), Text="Cashier", TextSize=14, TextXAlignment="Left", Font="SourceSans",
  102. BackgroundTransparency=1, Position=UDim2.new(0.4,0,0,0), TextColor3=Color3.new(1,1,1), TextScaled=true, BackgroundColor3=Color3.new(1,1,1)})
  103. 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)})
  104. cashierSlider=Create("Frame",cashierBtn,{Name="slider", Size=UDim2.new(0.5,-4,1,-4), Position=UDim2.new(settings.cashier and 0.5 or 0,2,0,2), BorderSizePixel=0, BackgroundColor3=Color3.new(0.784,0.784,0.784)})
  105. kitchen=Create("Frame",settings_1,{Name="kitchen", LayoutOrder=9, BackgroundTransparency=1, Size=UDim2.new(0,100,0,100), BackgroundColor3=Color3.new(1,1,1)})
  106. Label_2=Create("TextLabel",kitchen,{TextWrapped=true, Size=UDim2.new(0.6,0,1,0), Text="Kitchen TP:", TextSize=14, TextXAlignment="Right", Font="SourceSans",
  107. BackgroundTransparency=1, TextColor3=Color3.new(1,1,1), TextScaled=true, BackgroundColor3=Color3.new(1,1,1)})
  108. kitchenBtn=Create("TextButton",kitchen,{Name="kitchenBtn", TextWrapped=true, Size=UDim2.new(0.25,0,1,0), TextColor3=Color3.new(), Text=settings.stay_in_kitchen and "X" or "", Font="GothamBold",
  109. Position=UDim2.new(0.62,0,0,0), TextSize=35, TextScaled=true, BackgroundColor3=Color3.new(0.784,0.784,0.784)})
  110. refillEnd=Create("Frame",settings_1,{Name="refillEnd", LayoutOrder=8, BackgroundTransparency=1, Size=UDim2.new(0,100,0,100), BackgroundColor3=Color3.new(1,1,1)})
  111. 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(),
  112. Font="Code", Position=UDim2.new(0.62,0,0,0), TextScaled=true, BackgroundColor3=Color3.new(0.784,0.784,0.784)})
  113. Label_3=Create("TextLabel",refillEnd,{TextWrapped=true, Size=UDim2.new(0.6,0,1,0), Text="Refill End:", TextSize=14, TextXAlignment="Right", Font="SourceSans",
  114. BackgroundTransparency=1, TextColor3=Color3.new(1,1,1), TextScaled=true, BackgroundColor3=Color3.new(1,1,1)})
  115. refillAt=Create("Frame",settings_1,{Name="refillAt", LayoutOrder=7, BackgroundTransparency=1, Size=UDim2.new(0,100,0,100), BackgroundColor3=Color3.new(1,1,1)})
  116. Label_4=Create("TextLabel",refillAt,{TextWrapped=true, Size=UDim2.new(0.5,0,1,0), Text="Refill At:", TextSize=14, TextXAlignment="Right", Font="SourceSans",
  117. BackgroundTransparency=1, TextColor3=Color3.new(1,1,1), TextScaled=true, BackgroundColor3=Color3.new(1,1,1)})
  118. 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(),
  119. Font="Code", Position=UDim2.new(0.52,0,0,0), TextScaled=true, BackgroundColor3=Color3.new(0.784,0.784,0.784)})
  120. supplier=Create("Frame",settings_1,{Name="supplier", LayoutOrder=6, BackgroundTransparency=1, Size=UDim2.new(0,100,0,100), BackgroundColor3=Color3.new(1,1,1)})
  121. Label_5=Create("TextLabel",supplier,{TextWrapped=true, Size=UDim2.new(0.6,0,1,0), Text="Supplier", TextSize=14, TextXAlignment="Left", Font="SourceSans",
  122. BackgroundTransparency=1, Position=UDim2.new(0.4,0,0,0), TextColor3=Color3.new(1,1,1), TextScaled=true, BackgroundColor3=Color3.new(1,1,1)})
  123. 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)})
  124. supplierSlider=Create("Frame",supplierBtn,{Name="slider", Size=UDim2.new(0.5,-4,1,-4), Position=UDim2.new(settings.supplier and 0.5 or 0,2,0,2), BorderSizePixel=0, BackgroundColor3=Color3.new(0.784,0.784,0.784)})
  125. delivery=Create("Frame",settings_1,{Name="delivery", LayoutOrder=5, BackgroundTransparency=1, Size=UDim2.new(0,100,0,100), BackgroundColor3=Color3.new(1,1,1)})
  126. Label_6=Create("TextLabel",delivery,{TextWrapped=true, Size=UDim2.new(0.6,0,1,0), Text="Delivery", TextSize=14, TextXAlignment="Left", Font="SourceSans",
  127. BackgroundTransparency=1, Position=UDim2.new(0.4,0,0,0), TextColor3=Color3.new(1,1,1), TextScaled=true, BackgroundColor3=Color3.new(1,1,1)})
  128. 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)})
  129. deliverySlider=Create("Frame",deliveryBtn,{Name="slider", Size=UDim2.new(0.5,-4,1,-4), Position=UDim2.new(settings.delivery and 0.5 or 0,2,0,2), BorderSizePixel=0, BackgroundColor3=Color3.new(0.784,0.784,0.784)})
  130. boxer=Create("Frame",settings_1,{Name="boxer", LayoutOrder=2, BackgroundTransparency=1, Size=UDim2.new(0,100,0,100), BackgroundColor3=Color3.new(1,1,1)})
  131. boxerLbl=Create("TextLabel",boxer,{TextWrapped=true, Size=UDim2.new(0.6,0,1,0), Text="Boxer", TextSize=14, TextXAlignment="Left", Font="SourceSans",
  132. BackgroundTransparency=1, Position=UDim2.new(0.4,0,0,0), TextColor3=Color3.new(1,1,1), TextScaled=true, BackgroundColor3=Color3.new(1,1,1)})
  133. 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)})
  134. boxerSlider=Create("Frame",boxerBtn,{Name="slider", Size=UDim2.new(0.5,-4,1,-4), Position=UDim2.new(settings.boxer and 0.5 or 0,2,0,2), BorderSizePixel=0, BackgroundColor3=Color3.new(0.784,0.784,0.784)})
  135. cook=Create("Frame",settings_1,{Name="cook", LayoutOrder=3, BackgroundTransparency=1, Size=UDim2.new(0,100,0,100), BackgroundColor3=Color3.new(1,1,1)})
  136. cookLbl=Create("TextLabel",cook,{TextWrapped=true, Size=UDim2.new(0.6,0,1,0), Text="Cook", TextSize=14, TextXAlignment="Left", Font="SourceSans",
  137. BackgroundTransparency=1, Position=UDim2.new(0.4,0,0,0), TextColor3=Color3.new(1,1,1), TextScaled=true, BackgroundColor3=Color3.new(1,1,1)})
  138. 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)})
  139. cookSlider=Create("Frame",cookBtn,{Name="slider", Size=UDim2.new(0.5,-4,1,-4), Position=UDim2.new(settings.cook and 0.5 or 0,2,0,2), BorderSizePixel=0, BackgroundColor3=Color3.new(0.784,0.784,0.784)})
  140. toggleAll=Create("Frame",settings_1,{Name="toggleAll", LayoutOrder=1, BackgroundTransparency=1, Size=UDim2.new(0,100,0,100), BackgroundColor3=Color3.new(1,1,1)})
  141. switch=Create("Frame",toggleAll,{Name="switch", BackgroundTransparency=1, Size=UDim2.new(0.75,0,1,0), BackgroundColor3=Color3.new(1,1,1)})
  142. 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)})
  143. 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)})
  144. 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)})
  145. messageLbl=Create("TextLabel",topbar,{Name="messageLbl", Size=UDim2.new(0.5,0,1,0), Text="Saved.", TextSize=14, Font="GothamSemibold", BackgroundTransparency=1,
  146. Position=UDim2.new(0.07,0,0,0), TextColor3=Color3.new(1,1,1), Visible=false, TextXAlignment="Left"})
  147. 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)})
  148. 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,
  149. BackgroundColor3=Color3.new(1,1,1)})
  150. 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)})
  151. 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)})
  152.  
  153. local function toggleCashier(bool)
  154. if bool~=nil then
  155. settings.cashier=bool
  156. else
  157. settings.cashier = not settings.cashier
  158. end
  159. cashierSlider:TweenPosition(UDim2.new(settings.cashier and 0.5 or 0,2,0,2),nil,"Sine",0.1,true)
  160. end
  161. local function toggleCook(bool)
  162. if bool~=nil then
  163. settings.cook=bool
  164. else
  165. settings.cook = not settings.cook
  166. end
  167. cookSlider:TweenPosition(UDim2.new(settings.cook and 0.5 or 0,2,0,2),nil,"Sine",0.1,true)
  168. end
  169. local function toggleBoxer(bool)
  170. if bool~=nil then
  171. settings.boxer=bool
  172. else
  173. settings.boxer = not settings.boxer
  174. end
  175. boxerSlider:TweenPosition(UDim2.new(settings.boxer and 0.5 or 0,2,0,2),nil,"Sine",0.1,true)
  176. end
  177. local function toggleDelivery(bool)
  178. if bool~=nil then
  179. settings.delivery=bool
  180. else
  181. settings.delivery = not settings.delivery
  182. end
  183. deliverySlider:TweenPosition(UDim2.new(settings.delivery and 0.5 or 0,2,0,2),nil,"Sine",0.1,true)
  184. end
  185. local function toggleSupplier(bool)
  186. if bool~=nil then
  187. settings.supplier=bool
  188. else
  189. settings.supplier = not settings.supplier
  190. end
  191. supplierSlider:TweenPosition(UDim2.new(settings.supplier and 0.5 or 0,2,0,2),nil,"Sine",0.1,true)
  192. end
  193. cashierBtn.MouseButton1Click:Connect(toggleCashier)
  194. cookBtn.MouseButton1Click:Connect(toggleCook)
  195. boxerBtn.MouseButton1Click:Connect(toggleBoxer)
  196. deliveryBtn.MouseButton1Click:Connect(toggleDelivery)
  197. supplierBtn.MouseButton1Click:Connect(toggleSupplier)
  198. local function isMouseDown()
  199. return (game:GetService("UserInputService"):GetMouseButtonsPressed()[1] or {}).UserInputType==Enum.UserInputType.MouseButton1
  200. end
  201. allOffBtn.InputBegan:Connect(function()
  202. if isMouseDown() then
  203. toggleCashier(false)
  204. toggleCook(false)
  205. toggleBoxer(false)
  206. toggleDelivery(false)
  207. toggleSupplier(false)
  208. toggleAllSlider:TweenPosition(UDim2.new(0,0,0,-2),nil,"Sine",0.1,true)
  209. wait(1)
  210. if toggleAllSlider.Position.X.Scale<.01 then
  211. toggleAllSlider:TweenPosition(UDim2.new(0.45,0,0,-2),nil,"Sine",0.1,true)
  212. end
  213. end
  214. end)
  215. allOnBtn.InputBegan:Connect(function()
  216. if isMouseDown() then
  217. toggleCashier(true)
  218. toggleCook(true)
  219. toggleBoxer(true)
  220. toggleDelivery(true)
  221. toggleSupplier(true)
  222. toggleAllSlider:TweenPosition(UDim2.new(0.9,0,0,-2),nil,"Sine",0.1,true)
  223. wait(1)
  224. if toggleAllSlider.Position.X.Scale>.88 then
  225. toggleAllSlider:TweenPosition(UDim2.new(0.45,0,0,-2),nil,"Sine",0.1,true)
  226. end
  227. end
  228. end)
  229. kitchenBtn.MouseButton1Click:Connect(function()
  230. settings.stay_in_kitchen = not settings.stay_in_kitchen
  231. kitchenBtn.Text = settings.stay_in_kitchen and "X" or ""
  232. end)
  233. local oldRefillAt=refillAtBox.Text
  234. refillAtBox:GetPropertyChangedSignal("Text"):Connect(function()
  235. if #refillAtBox.Text>2 or refillAtBox.Text:match("%D") then
  236. refillAtBox.Text = oldRefillAt
  237. end
  238. oldRefillAt = refillAtBox.Text
  239. end)
  240. refillAtBox.FocusLost:Connect(function()
  241. if tonumber(refillAtBox.Text) then
  242. settings.refill_at=tonumber(refillAtBox.Text)
  243. end
  244. refillAtBox.Text=tostring(settings.refill_at)
  245. end)
  246. local oldRefillEnd=refillEndBox.Text
  247. refillEndBox:GetPropertyChangedSignal("Text"):Connect(function()
  248. if #refillEndBox.Text>2 or refillEndBox.Text:match("%D") then
  249. refillEndBox.Text = oldRefillEnd
  250. end
  251. oldRefillEnd = refillEndBox.Text
  252. end)
  253. refillEndBox.FocusLost:Connect(function()
  254. if tonumber(refillEndBox.Text) then
  255. settings.refill_end=tonumber(refillEndBox.Text)
  256. end
  257. refillEndBox.Text=tostring(settings.refill_end)
  258. end)
  259. closeBtn.MouseButton1Click:Connect(function() gui:Destroy() end)
  260. closeBtn.MouseEnter:Connect(function() closeBtn.TextColor3=Color3.new(.9,0,0) end)
  261. closeBtn.MouseLeave:Connect(function() closeBtn.TextColor3=Color3.new(1,1,1) end)
  262. saveBtn.MouseButton1Click:Connect(function()
  263. if writefile and messageLbl.Visible==false then
  264. writefile("PizzaFarm.txt",game:GetService("HttpService"):JSONEncode(settings))
  265. messageLbl.Visible=true
  266. wait(2)
  267. messageLbl.Visible=false
  268. end
  269. end)
  270. 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)}
  271. local cameraIndex = 0
  272. centerCamBtn.MouseButton1Click:Connect(function()
  273. cameraIndex = 0
  274. workspace.CurrentCamera.CameraType = "Custom"
  275. end)
  276. leftCamBtn.MouseButton1Click:Connect(function()
  277. cameraIndex = cameraIndex - 1
  278. if cameraIndex < 0 then
  279. cameraIndex = #cameraArray
  280. end
  281. if cameraIndex == 0 then
  282. workspace.CurrentCamera.CameraType="Custom"
  283. else
  284. local cf = cameraArray[cameraIndex]
  285. workspace.CurrentCamera.CameraType="Scriptable"
  286. workspace.CurrentCamera:Interpolate(cf,cf+cf.lookVector*10,0.5)
  287. end
  288. end)
  289. rightCamBtn.MouseButton1Click:Connect(function()
  290. cameraIndex = cameraIndex + 1
  291. if cameraIndex > #cameraArray then
  292. cameraIndex = 0
  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.  
  301. --//subroutines
  302. local supplyCounts = {TomatoSauce=99,Cheese=99,Sausage=99,Pepperoni=99,Dough=99,Box=99,Dew=99}
  303. for name in pairs(supplyCounts) do
  304. local lbl = workspace.SupplyCounters[name=="Dew" and "CounterMountainDew" or "Counter"..name].a.SG.Counter
  305. supplyCounts[name]=tonumber(lbl.Text)
  306. lbl.Changed:Connect(function()
  307. supplyCounts[name]=tonumber(lbl.Text)
  308. end)
  309. end
  310.  
  311. local function FindFirstCustomer()
  312. local children = workspace.Customers:GetChildren()
  313. for i=1,#children do
  314. local c = children[i]
  315. if ffc(c,"Head") and ffc(c,"Humanoid") and c.Head.CFrame.Z<102 and (ffc(c.Head,"ChatBubble")==nil or ffc(c.Head.ChatBubble,"Bubble")==nil) and ((c.Humanoid.SeatPart and c.Humanoid.SeatPart.Anchored) or (c.Humanoid.SeatPart==nil and (c.Head.Velocity.Z^2)^.5<.0001)) then
  316. return c
  317. end
  318. end
  319. end
  320.  
  321. local boxPtick=0
  322. local boxDtick=0
  323. local function FindBoxes()
  324. local c,o,f
  325. local children = workspace.AllBox:GetChildren()
  326. for i=1,#children do
  327. local b = children[i]
  328. if ffc(b,"HasPizzaInside") or ffc(b,"Pizza") then
  329. if c==nil and b.Name=="BoxClosed" and b.Anchored==false and not b.HasPizzaInside.Value then
  330. c=b
  331. elseif o==nil and b.Name=="BoxOpen" and b.Anchored==false and not b.Pizza.Value then
  332. o=b
  333. elseif f==nil and (b.Name=="BoxOpen" and b.Pizza.Value) or (b.Name=="BoxClosed" and b.HasPizzaInside.Value) then
  334. f=b
  335. end
  336. if c and o and f then
  337. return c,o,f
  338. end
  339. end
  340. end
  341. return c,o,f
  342. end
  343. local function FindBoxingFoods()
  344. local p,d
  345. local children = workspace.BoxingRoom:GetChildren()
  346. for i=1,#children do
  347. local f = children[i]
  348. if not f.Anchored then
  349. if p==nil and f.Name=="Pizza" then
  350. p=f
  351. elseif d==nil and f.Name=="Dew" then
  352. d=f
  353. end
  354. if p and d then
  355. return p,d
  356. end
  357. end
  358. end
  359. return p,d
  360. end
  361.  
  362. local orderDict={["168541857"]="Cheese",["168541778"]="Sausage",["168540808"]="Pepperoni",["2512571151"]="Dew"}
  363. local cookingDict = {Cheese=0,Sausage=0,Pepperoni=0,Dew=0}
  364. local cookPtick=0
  365. local cookDtick=0
  366. local cookWarned=false
  367. local boxerWarned=false
  368. local function getOrders()
  369. local orders={}
  370. local tempCookingDict = {}
  371. for i,v in pairs(cookingDict) do tempCookingDict[i]=v end
  372. local children = workspace.Orders:GetChildren()
  373. for i=1,#children do
  374. local o = orderDict[children[i].SG.ImageLabel.Image:match("%d+$")]
  375. if o then
  376. if tempCookingDict[o]>0 then
  377. --ignores oven pizzas, so new orders are priority
  378. tempCookingDict[o]=tempCookingDict[o]-1
  379. elseif (o=="Dew" and #workspace.AllMountainDew:GetChildren()>0) or (supplyCounts[o]>0 and supplyCounts.TomatoSauce>0 and supplyCounts.Cheese>0) then
  380. --need supplies
  381. orders[#orders+1]=o
  382. end
  383. end
  384. end
  385. return orders
  386. end
  387. local function FindFirstDew()
  388. local children = workspace.AllMountainDew:GetChildren()
  389. for i=1,#children do
  390. if not children[i].Anchored then
  391. return children[i]
  392. end
  393. end
  394. end
  395. local function FindDoughAndWithout(str)
  396. local goodraw,p,raw,trash
  397. local children = workspace.AllDough:GetChildren()
  398. for i = #children, 2, -1 do --shuffle
  399. local j = RNG:NextInteger(1, i)
  400. children[j], children[i] = children[i], children[j]
  401. end
  402. for i=1,#children do
  403. local d = children[i]
  404. if d.Anchored==false and #d:GetChildren()>9 then
  405. if d.IsBurned.Value or d.HasBugs.Value or d.Cold.Value or (d.BrickColor.Name=="Bright orange" and ffc(d,"XBillboard")) then
  406. if trash==nil and d.Position.Y > 0 then
  407. trash=d
  408. end
  409. elseif p==nil and d.BrickColor.Name=="Bright orange" then
  410. p=d
  411. 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
  412. --prefers flat
  413. if d.Mesh.Scale.Y<1.1 then
  414. goodraw=d
  415. else
  416. raw=d
  417. end
  418. end
  419. if goodraw and p and trash then
  420. return goodraw,p,trash
  421. end
  422. end
  423. end
  424. return goodraw or raw,p,trash
  425. end
  426. local function getOvenNear(pos)
  427. local children = workspace.Ovens:GetChildren()
  428. for i=1,#children do
  429. if (children[i].Bottom.Position-pos).magnitude < 1.5 then
  430. return children[i]
  431. end
  432. end
  433. end
  434. local function getDoughNear(pos)
  435. local children = workspace.AllDough:GetChildren()
  436. for i=1,#children do
  437. if (children[i].Position-pos).magnitude < 1.5 then
  438. return children[i]
  439. end
  440. end
  441. end
  442. local function isFullyOpen(oven)
  443. return oven.IsOpen.Value==true and (oven.Door.Meter.RotVelocity.Z^2)^.5<.0001
  444. end
  445.  
  446. local bcolorToSupply = {["Dark orange"]="Sausage",["Bright blue"]="Pepperoni",["Bright yellow"]="Cheese",["Bright red"]="TomatoSauce",["Dark green"]="Dew",["Brick yellow"]="Dough",["Light stone grey"]="Box"}
  447. local supplyButtons = {}
  448. for _,button in ipairs(workspace.SupplyButtons:GetChildren()) do
  449. supplyButtons[bcolorToSupply[button.Unpressed.BrickColor.Name]] = button.Unpressed
  450. end
  451.  
  452. local delTool
  453. local delTouchTick=0
  454. local function FindFirstDeliveryTool()
  455. local t
  456. local children = workspace:GetChildren()
  457. for i=1,#children do
  458. local v = children[i]
  459. if v.ClassName=="Tool" and v.Name:match("^%u%d$") and ffc(v,"House") and ffc(v,"Handle") and ffc(v,"Order") and v.Order.Value:match("%a") then
  460. if ffc(v.Handle,"X10") then
  461. return v
  462. end
  463. t = v
  464. end
  465. end
  466. return t
  467. end
  468. local function getHousePart(address)
  469. local houses = workspace.Houses:GetChildren()
  470. for i=1,#houses do
  471. local h = houses[i]
  472. if ffc(h,"Address") and h.Address.Value==address and ffc(h,"Upgrades") and h.Upgrades:GetChildren()[1] and ffc(h.Upgrades:GetChildren()[1],"GivePizza") then
  473. return h.Upgrades:GetChildren()[1].GivePizza
  474. end
  475. end
  476. end
  477. local function forgetDeliveryTool()
  478. if delTool then
  479. if delTool.Parent==player.Backpack then
  480. delTool.Parent = character
  481. end
  482. if delTool.Parent==character then
  483. wait(0.1)
  484. delTool.Parent = workspace
  485. wait(0.1)
  486. end
  487. end
  488. delTool=nil
  489. if ffc(character,"RightHand") and ffc(character.RightHand,"RightGrip") then
  490. character.RightHand.RightGrip:Destroy()
  491. end
  492. end
  493.  
  494. local function onCharacterAdded(char)
  495. if not char then return end
  496. character=char
  497. root = character:WaitForChild("HumanoidRootPart")
  498. character:WaitForChild("Humanoid"):GetPropertyChangedSignal("WalkSpeed"):Connect(function()
  499. if delTool then
  500. character.Humanoid.WalkSpeed=16
  501. end
  502. end)
  503. end
  504. onCharacterAdded(player.Character or player.CharacterAdded:Wait())
  505. player.CharacterAdded:Connect(onCharacterAdded)
  506.  
  507. local function simTouch(part)
  508. local oldcc = part.CanCollide
  509. local oldcf = part.CFrame
  510. part.CanCollide = false
  511. part.CFrame = root.CFrame
  512. delay(0.07,function()
  513. part.CFrame = oldcf
  514. part.CanCollide = oldcc
  515. end)
  516. end
  517.  
  518. spawn(function()
  519. --//cashier
  520. while wait(0.33) and gui.Parent do
  521. if settings.cashier then
  522. local c = FindFirstCustomer()
  523. if c then
  524. workspace.GameService.OrderCompleted:FireServer(c, false, workspace.Register3)
  525. end
  526. end
  527. end
  528. end)
  529.  
  530. --//main loop
  531. while wait(0.36) and gui.Parent do --this needs to be enough time for a server ping
  532. --local orders = getOrders()
  533. --local printstr = '{ '
  534. --for i=1,#orders do
  535. -- printstr=printstr..orders[i]:sub(1,3).." "
  536. --end
  537. --printstr=printstr.."}\n{ Cheese="..tostring(cookingDict.Cheese)..",Sausage="..tostring(cookingDict.Sausage)..",Pepperoni="..tostring(cookingDict.Pepperoni).." }"
  538. --print(printstr)
  539. local boxP,boxD = FindBoxingFoods()
  540. local closedBox,openBox,fullBox = FindBoxes()
  541. local order = getOrders()[1]
  542. local topping
  543. if order=="Pepperoni" or order=="Sausage" then topping=order end
  544. local cookD = FindFirstDew()
  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 del = FindFirstDeliveryTool()
  553.  
  554. --//boxer
  555. boxerLbl.Text="Boxer"
  556. boxerLbl.TextColor3=Color3.new(1,1,1)
  557. if settings.boxer and (root.Position-Vector3.new(69,6,15.5)).magnitude<50 then
  558. if boxD and tick()-boxDtick>0.8 then
  559. boxDtick=tick()
  560. workspace.GameService.UpdateObjectProperty:FireServer(true, boxD, "CFrame", CFrame.new(63,4.9,-1,-1,0,0,0,1,0,0,0,-1), remoteKey)
  561. end
  562. if fullBox then
  563. if fullBox.Name=="BoxOpen" then
  564. workspace.GameService.CloseBox:FireServer(fullBox)
  565. --will be moved next loop
  566. elseif tick()-boxPtick>0.8 then
  567. workspace.GameService.UpdateObjectProperty:FireServer(true, fullBox, "CFrame", CFrame.new(68.2,4.4,-1,-1,0,0,0,1,0,0,0,-1), remoteKey)
  568. boxPtick=tick()
  569. end
  570. end
  571. if closedBox and not openBox then
  572. workspace.GameService.UpdateObjectProperty:FireServer(true, closedBox, "CFrame", CFrame.new(RNG:NextNumber(62.5,70.5),3.5,RNG:NextNumber(11,25)), remoteKey)
  573. wait()
  574. workspace.GameService.OpenBox:FireServer(closedBox)
  575. end
  576. if openBox and boxP then
  577. workspace.GameService.UpdateObjectProperty:FireServer(true, boxP, "Anchored", true, remoteKey)
  578. workspace.GameService.UpdateObjectProperty:FireServer(true, openBox, "Anchored", true, remoteKey)
  579. wait()
  580. workspace.GameService.UpdateObjectProperty:FireServer(true, boxP, "CFrame", openBox.CFrame+Vector3.new(0,-2,0), remoteKey)
  581. wait()
  582. workspace.GameService.AssignPizzaToBox:FireServer(openBox, boxP)
  583. end
  584. elseif settings.boxer then
  585. if settings.stay_in_kitchen then
  586. root.CFrame = CFrame.new(44,6,41.5)*CFrame.Angles(0,math.pi/2,0)
  587. elseif boxerWarned then
  588. boxerWarned=false
  589. else
  590. boxerLbl.TextColor3=Color3.new(.9,0,0)
  591. boxerLbl.Text="TOO FAR"
  592. boxerWarned=true
  593. end
  594. end
  595. --//cook
  596. cookLbl.Text="Cook"
  597. cookLbl.TextColor3=Color3.new(1,1,1)
  598. if settings.cook and (root.Position-Vector3.new(55.5,3.2,63)).magnitude<39 then
  599. local ovens = workspace.Ovens:GetChildren()
  600. for i = #ovens, 2, -1 do --shuffle
  601. local j = RNG:NextInteger(1, i)
  602. ovens[j], ovens[i] = ovens[i], ovens[j]
  603. end
  604. --move final pizza
  605. if cookP and tick()-cookPtick>0.8 then
  606. local oven = getOvenNear(cookP.Position)
  607. if oven==nil or oven.IsOpen.Value then
  608. cookPtick=tick()
  609. workspace.GameService.UpdateObjectProperty:FireServer(true, cookP, "CFrame", CFrame.new(56,4.1,38), remoteKey)
  610. end
  611. end
  612. if order then
  613. if order=="Dew" and cookD and tick()-cookDtick>0.8 then
  614. --move dew if ordered
  615. cookDtick=tick()
  616. workspace.GameService.UpdateObjectProperty:FireServer(true, cookD, "CFrame", CFrame.new(53,4.68,36.5), remoteKey)
  617. elseif order~="Dew" and raw and raw.Parent and supplyCounts[order]>0 and supplyCounts.TomatoSauce>0 and supplyCounts.Cheese>0 then
  618. --make pizza
  619. if raw.Mesh.Scale.Y>1.5 then
  620. workspace.GameService.UpdateObjectProperty:FireServer(true, raw, "CFrame", CFrame.new(RNG:NextNumber(29.6,44.6),3.7,RNG:NextNumber(42.5,48.5)), remoteKey)
  621. wait()
  622. workspace.GameService.SquishDough:FireServer(raw)
  623. else
  624. --make sure it will have an oven
  625. local oven
  626. for _,o in ipairs(ovens) do
  627. if isFullyOpen(o) then
  628. local other = getDoughNear(o.Bottom.Position)
  629. if other==nil or not (other.BrickColor.Name=="Bright orange" and ffc(other.SG.Frame,"TomatoSauce") and ffc(other.SG.Frame,"MeltedCheese")) then
  630. if other then
  631. --replace mistaken dough
  632. workspace.GameService.UpdateObjectProperty:FireServer(true, other, "CFrame", CFrame.new(RNG:NextNumber(29.6,44.6),3.7,RNG:NextNumber(42.5,48.5)), remoteKey)
  633. wait()
  634. end
  635. oven=o
  636. break
  637. end
  638. end
  639. end
  640. if oven and raw.Parent==workspace.AllDough then
  641. --make
  642. for _,v in ipairs({"TomatoSauce","Cheese",topping}) do
  643. workspace.GameService.AddIngredientToPizza:FireServer(raw,v)
  644. end
  645. workspace.GameService.UpdateObjectProperty:FireServer(true, raw, "CFrame", oven.Bottom.CFrame+Vector3.new(0,0.7,0), remoteKey)
  646. oven.Door.ClickDetector.Detector:FireServer()
  647. --mark as cooking
  648. cookingDict[order]=cookingDict[order]+1
  649. local revoked=false
  650. spawn(function()
  651. raw.AncestryChanged:Wait()
  652. if not revoked then
  653. cookingDict[order]=cookingDict[order]-1
  654. revoked=true
  655. end
  656. end)
  657. delay(40, function()
  658. if not revoked then
  659. cookingDict[order]=cookingDict[order]-1
  660. revoked=true
  661. end
  662. end)
  663. end
  664. end
  665. end
  666. end
  667. --open unnecessarily closed ovens
  668. for _,o in ipairs(ovens) do
  669. local bar = o.Door.Meter.SurfaceGui.ProgressBar.Bar
  670. 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
  671. o.Door.ClickDetector.Detector:FireServer()
  672. break
  673. end
  674. end
  675. --trash
  676. if trash and (trash.IsBurned.Value==false or getOvenNear(trash.Position)==nil or getOvenNear(trash.Position).IsOpen.Value) then
  677. --closed oven breaks if you take burnt out of it
  678. workspace.GameService.UpdateObjectProperty:FireServer(true, trash, "CFrame", CFrame.new(47.9,RNG:NextNumber(-10,-30),72.5), remoteKey)
  679. end
  680. elseif settings.cook then
  681. if settings.stay_in_kitchen then
  682. root.CFrame = CFrame.new(44,6,41.5)*CFrame.Angles(0,math.pi/2,0)
  683. elseif cookWarned then
  684. cookWarned=false
  685. else
  686. cookLbl.TextColor3=Color3.new(.9,0,0)
  687. cookLbl.Text="TOO FAR"
  688. cookWarned=true
  689. end
  690. end
  691. --//supplier
  692. if settings.supplier then
  693. local refill=false
  694. for s,c in pairs(supplyCounts) do
  695. if c <= settings.refill_at then
  696. refill=true
  697. break
  698. end
  699. end
  700. if refill then
  701. local oldcf = root.CFrame
  702. local alt=0
  703. local waiting = false
  704. local waitingTick = 0
  705. local lastBox
  706. while settings.supplier do
  707. --check if refill is done otherwise hit buttons
  708. local fulfilled=true
  709. local boxes = workspace.AllSupplyBoxes:GetChildren()
  710. for s,c in pairs(supplyCounts) do
  711. if c<settings.refill_end then
  712. fulfilled=false
  713. local count = 0
  714. if #boxes > 30 then
  715. for i=1,#boxes do
  716. local box = boxes[i]
  717. if bcolorToSupply[box.BrickColor.Name]==s and box.Anchored==false and box.Position.Z < -740 then
  718. count=count+1
  719. end
  720. end
  721. end
  722. if count < 2 then
  723. simTouch(supplyButtons[s])
  724. end
  725. end
  726. end
  727. if fulfilled then
  728. break
  729. end
  730. wait(1.5)
  731. --check if can finish waiting for boxes to move
  732. if waiting and (lastBox.Position.X>42 or tick()-waitingTick>5) then
  733. waiting=false
  734. if lastBox.Position.X<42 then
  735. --clear boxes if stuck
  736. root.CFrame=CFrame.new(20.5,8,-35)
  737. wait(0.1)
  738. local boxes = workspace.AllSupplyBoxes:GetChildren()
  739. for i=1,#boxes do
  740. local box = boxes[i]
  741. if box.Anchored==false and box.Position.Z>-55 then
  742. workspace.GameService.UpdateObjectProperty:FireServer(true, box, "CFrame", CFrame.new(RNG:NextNumber(0,40),RNG:NextNumber(-10,-30),-70), remoteKey)
  743. wait()
  744. end
  745. end
  746. wait(0.1)
  747. end
  748. end
  749. if not waiting then
  750. --move boxes
  751. root.CFrame=CFrame.new(8,12.4,-795)
  752. wait(0.1)
  753. alt=1-alt
  754. lastBox=nil
  755. local j=0
  756. local boxes = workspace.AllSupplyBoxes:GetChildren()
  757. for i=1,#boxes do
  758. local box = boxes[i]
  759. if box.Anchored==false and box.Position.Z < -740 and bcolorToSupply[box.BrickColor.Name] and supplyCounts[bcolorToSupply[box.BrickColor.Name]]<settings.refill_end then
  760. box.CFrame = CFrame.new(38-4*j,5,-7-5*alt)
  761. workspace.GameService.UpdateObjectProperty:FireServer(true, box, "CFrame", box.CFrame, remoteKey)
  762. lastBox=box
  763. j=j+1
  764. if j>8 then break end
  765. end
  766. end
  767. if alt==0 and lastBox then
  768. waiting=true
  769. waitingTick=tick()
  770. end
  771. end
  772. end
  773. root.CFrame=oldcf
  774. end
  775. end
  776. --//delivery
  777. if settings.delivery then
  778. if delTool==nil and del then
  779. --get tool
  780. delTool=del
  781. delTool.Handle.CanCollide=false
  782. delTool.Handle.CFrame = root.CFrame
  783. delay(5,forgetDeliveryTool)
  784. elseif delTool and delTool.Parent==character and tick()-delTouchTick>0.7 then
  785. --deliver to house
  786. local housePart = getHousePart(delTool.Name)
  787. if housePart then
  788. delTouchTick=tick()
  789. simTouch(housePart)
  790. end
  791. end
  792. end
  793. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement