Advertisement
Hydasi

(New) Work At A Pizza Place GUI

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