ryghost

Untitled

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