Advertisement
MaxproGlitcher

Fix Auto Farm by Max

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