MaxproGlitcher

auto farm by Max

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