SHARE
TWEET

Work at a pizza place

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