electrify

Script - Pizza Place - AUTOFARM(full script)

Sep 19th, 2020
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 35.09 KB | None | 0 0
  1. --https://v3rmillion.net/showthread.php?tid=723696
  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 sirelKilla",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,"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
  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 dialog = c.Head.Dialog.Correct.ResponseDialog or ''
  537.             local rootMoved = false
  538.             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
  539.             local order = "MountainDew"
  540.             if dialog:sub(-8)=="instead." then
  541.                 dialog = dialog:sub(-30)
  542.             end
  543.             if dialog:find("pepperoni",1,true) then
  544.                 order = "PepperoniPizza"
  545.             elseif dialog:find("sausage",1,true) then
  546.                 order = "SausagePizza"
  547.             elseif dialog:find("cheese",1,true) then
  548.                 order = "CheesePizza"
  549.             end
  550.            
  551.             workspace.GameService.OrderCompleted:FireServer(c, order, workspace.Register3)
  552.             if rootMoved then wait(.1) end
  553.         end
  554.     end
  555.     if doCook then
  556.         local order = getOrders()[1]
  557.         local topping
  558.         if order=="Pepperoni" or order=="Sausage" then topping=order end
  559.         local cookD = FindFirstDew()
  560.         local raw,cookP,trash
  561.         if topping then
  562.             --pepperoni order avoids sausage dough and vice verca
  563.             raw,cookP,trash = FindDoughAndWithout(topping=="Pepperoni" and "Sausage" or "Pepperoni")
  564.         else
  565.             raw,cookP,trash = FindDoughAndWithout()
  566.         end
  567.         local rootMoved = false
  568.         local ovens = workspace.Ovens:GetChildren()
  569.         for i = #ovens, 2, -1 do --shuffle
  570.             local j = RNG:NextInteger(1, i)
  571.             ovens[j], ovens[i] = ovens[i], ovens[j]
  572.         end
  573.         --move final pizza
  574.         if cookP and tick()-cookPtick>0.8 then
  575.             local oven = getOvenNear(cookP.Position)
  576.             if oven==nil or oven.IsOpen.Value then
  577.                 cookPtick=tick()
  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, cookP, "CFrame", CFrame.new(56,4.1,38), remoteKey)
  580.             end
  581.         end
  582.         if order then
  583.             if order=="Dew" and cookD and tick()-cookDtick>0.8 then
  584.                 --move dew if ordered
  585.                 cookDtick=tick()
  586.                 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
  587.                 workspace.GameService.UpdateObjectProperty:FireServer(true, cookD, "CFrame", CFrame.new(53,4.68,36.5), remoteKey)
  588.             elseif order~="Dew" and raw and raw.Parent and supplyCounts[order]>0 and supplyCounts.TomatoSauce>0 and supplyCounts.Cheese>0 then
  589.                 --make pizza
  590.                 if raw.Mesh.Scale.Y>1.5 then
  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, raw, "CFrame", CFrame.new(RNG:NextNumber(29.6,44.6),3.7,RNG:NextNumber(42.5,48.5)), remoteKey)
  593.                     wait()
  594.                     workspace.GameService.SquishDough:FireServer(raw)
  595.                 else
  596.                     --make sure it will have an oven
  597.                     local oven
  598.                     for _,o in ipairs(ovens) do
  599.                         if isFullyOpen(o) then
  600.                             local other = getDoughNear(o.Bottom.Position)
  601.                             if other==nil or not (other.BrickColor.Name=="Bright orange" and ffc(other.SG.Frame,"TomatoSauce") and ffc(other.SG.Frame,"MeltedCheese")) then
  602.                                 if other then
  603.                                     --replace mistaken dough
  604.                                     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
  605.                                     workspace.GameService.UpdateObjectProperty:FireServer(true, other, "CFrame", CFrame.new(RNG:NextNumber(29.6,44.6),3.7,RNG:NextNumber(42.5,48.5)), remoteKey)
  606.                                     wait()
  607.                                 end
  608.                                 oven=o
  609.                                 break
  610.                             end
  611.                         end
  612.                     end
  613.                     if oven and raw.Parent==workspace.AllDough then
  614.                         --make
  615.                         if (root.Position-Vector3.new(44.63, 6.60, 45.20)).magnitude>9 then rootMoved = true root.CFrame = CFrame.new(44.63, 6.60, 45.20) wait(.1) end
  616.                         workspace.GameService.AddIngredientToPizza:FireServer(raw,"TomatoSauce")
  617.                         workspace.GameService.AddIngredientToPizza:FireServer(raw,"Cheese")
  618.                         workspace.GameService.AddIngredientToPizza:FireServer(raw,topping)
  619.                         workspace.GameService.UpdateObjectProperty:FireServer(true, raw, "CFrame", oven.Bottom.CFrame+Vector3.new(0,0.7,0), remoteKey)
  620.                         oven.Door.ClickDetector.Detector:FireServer()
  621.                         --mark as cooking
  622.                         cookingDict[order]=cookingDict[order]+1
  623.                         local revoked=false
  624.                         spawn(function()
  625.                             raw.AncestryChanged:Wait()
  626.                             if not revoked then
  627.                                 cookingDict[order]=cookingDict[order]-1
  628.                                 revoked=true
  629.                             end
  630.                         end)
  631.                         delay(40, function()
  632.                             if not revoked then
  633.                                 cookingDict[order]=cookingDict[order]-1
  634.                                 revoked=true
  635.                             end
  636.                         end)
  637.                     end
  638.                 end
  639.             end
  640.         end
  641.         --open unnecessarily closed ovens
  642.         for _,o in ipairs(ovens) do
  643.             local bar = o.Door.Meter.SurfaceGui.ProgressBar.Bar
  644.             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
  645.                 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
  646.                 o.Door.ClickDetector.Detector:FireServer()
  647.                 break
  648.             end
  649.         end
  650.         --trash
  651.         if trash and (trash.IsBurned.Value==false or getOvenNear(trash.Position)==nil or getOvenNear(trash.Position).IsOpen.Value) then
  652.             --closed oven breaks if you take burnt out of it
  653.             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
  654.             workspace.GameService.UpdateObjectProperty:FireServer(true, trash, "CFrame", CFrame.new(47.9,RNG:NextNumber(-10,-30),72.5), remoteKey)
  655.         end
  656.         if rootMoved then wait(.1) end
  657.     end
  658.     if doBoxer then
  659.         local boxP,boxD = FindBoxingFoods()
  660.         local closedBox,openBox,fullBox = FindBoxes()
  661.         local rootMoved = false
  662.         if boxD and tick()-boxDtick>0.8 then
  663.             boxDtick=tick()
  664.             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
  665.             workspace.GameService.UpdateObjectProperty:FireServer(true, boxD, "CFrame", CFrame.new(63,4.9,-1,-1,0,0,0,1,0,0,0,-1), remoteKey)
  666.         end
  667.         if fullBox then
  668.             if fullBox.Name=="BoxOpen" then
  669.                 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
  670.                 workspace.GameService.CloseBox:FireServer(fullBox)
  671.                 --will be moved next loop
  672.             elseif tick()-boxPtick>0.8 then
  673.                 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
  674.                 workspace.GameService.UpdateObjectProperty:FireServer(true, fullBox, "CFrame", CFrame.new(68.2,4.4,-1,-1,0,0,0,1,0,0,0,-1), remoteKey)
  675.                 boxPtick=tick()
  676.             end
  677.         end
  678.         if closedBox and not openBox 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.             workspace.GameService.UpdateObjectProperty:FireServer(true, closedBox, "CFrame", CFrame.new(RNG:NextNumber(62.5,70.5),3.5,RNG:NextNumber(11,25)), remoteKey)
  681.             wait()
  682.             workspace.GameService.OpenBox:FireServer(closedBox)
  683.         end
  684.         if openBox and boxP then
  685.             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
  686.             workspace.GameService.UpdateObjectProperty:FireServer(true, boxP, "Anchored", true, remoteKey)
  687.             workspace.GameService.UpdateObjectProperty:FireServer(true, openBox, "Anchored", true, remoteKey)
  688.             wait()
  689.             workspace.GameService.UpdateObjectProperty:FireServer(true, boxP, "CFrame", openBox.CFrame+Vector3.new(0,-2,0), remoteKey)
  690.             wait()
  691.             workspace.GameService.AssignPizzaToBox:FireServer(openBox, boxP)
  692.         end
  693.         if rootMoved then wait(.1) end
  694.     end
  695.     if doSupplier then
  696.         local refill=false
  697.         for s,c in pairs(supplyCounts) do
  698.             if c <= settings.refill_at then
  699.                 refill=true
  700.                 break
  701.             end
  702.         end
  703.         if refill then
  704.             local oldcf = root.CFrame
  705.             local alt=0
  706.             local waiting = false
  707.             local waitingTick = 0
  708.             local lastBox
  709.             while doSupplier do
  710.                 --check if refill is done otherwise hit buttons
  711.                 local fulfilled=true
  712.                 local boxes = workspace.AllSupplyBoxes:GetChildren()
  713.                 for s,c in pairs(supplyCounts) do
  714.                     if c<settings.refill_end then
  715.                         fulfilled=false
  716.                         local count = 0
  717.                         if #boxes > 30 then
  718.                             for i=1,#boxes do
  719.                                 local box = boxes[i]
  720.                                 if bcolorToSupply[box.BrickColor.Name]==s and box.Anchored==false and box.Position.Z < -940 then
  721.                                     count=count+1
  722.                                 end
  723.                             end
  724.                         end
  725.                         if count < 2 then
  726.                             simTouch(supplyButtons[s])
  727.                         end
  728.                     end
  729.                 end
  730.                 if fulfilled then
  731.                     break
  732.                 end
  733.                 wait(1.5)
  734.                 --check if can finish waiting for boxes to move
  735.                 if waiting and (lastBox.Position.X>42 or tick()-waitingTick>5) then
  736.                     waiting=false
  737.                     if lastBox.Position.X<42 then
  738.                         --clear boxes if stuck
  739.                         root.CFrame=CFrame.new(20.5,8,-35)
  740.                         wait(0.1)
  741.                         local boxes = workspace.AllSupplyBoxes:GetChildren()
  742.                         for i=1,#boxes do
  743.                             local box = boxes[i]
  744.                             if box.Anchored==false and box.Position.Z>-55 then
  745.                                 workspace.GameService.UpdateObjectProperty:FireServer(true, box, "CFrame", CFrame.new(RNG:NextNumber(0,40),RNG:NextNumber(-10,-30),-70), remoteKey)
  746.                                 wait()
  747.                             end
  748.                         end
  749.                         wait(0.1)
  750.                     end
  751.                 end
  752.                 if not waiting then
  753.                     --move boxes
  754.                     root.CFrame=CFrame.new(8,12.4,-1020)
  755.                     wait(0.1)
  756.                     alt=1-alt
  757.                     lastBox=nil
  758.                     local j=0
  759.                     local boxes = workspace.AllSupplyBoxes:GetChildren()
  760.                     for i=1,#boxes do
  761.                         local box = boxes[i]
  762.                         if box.Anchored==false and box.Position.Z < -940 and bcolorToSupply[box.BrickColor.Name] and supplyCounts[bcolorToSupply[box.BrickColor.Name]]<settings.refill_end then
  763.                             box.CFrame = CFrame.new(38-4*j,5,-7-5*alt)
  764.                             workspace.GameService.UpdateObjectProperty:FireServer(true, box, "CFrame", box.CFrame, remoteKey)
  765.                             lastBox=box
  766.                             j=j+1
  767.                             if j>8 then break end
  768.                         end
  769.                     end
  770.                     if alt==0 and lastBox then
  771.                         waiting=true
  772.                         waitingTick=tick()
  773.                     end
  774.                 end
  775.             end
  776.             root.CFrame=oldcf
  777.         end
  778.     end
  779.     if doDelivery then
  780.         local del = FindFirstDeliveryTool()
  781.         if delTool==nil and del then
  782.             --get tool
  783.             delTool=del
  784.             delTool.Handle.CanCollide=false
  785.             delTool.Handle.CFrame = root.CFrame
  786.             delay(6,forgetDeliveryTool)
  787.         elseif delTool and delTool.Parent==character and delTouched==false then
  788.             --deliver to house
  789.             local housePart = getHousePart(delTool.Name)
  790.             if housePart then
  791.                 delTouched=true
  792.                 root.CFrame = housePart.CFrame+Vector3.new(0,9,0)
  793.                 wait(0.3)
  794.             end
  795.         end
  796.     end
  797. local hum = character:FindFirstChild("Humanoid")
  798. if hum and hum.Sit then hum.Jump = true end
  799. end
Add Comment
Please, Sign In to add comment