function pizzaCheck(SpTable)
local myTable = SpTable
if myTable:FindFirstChild('Tomato') or myTable:FindFirstChild('Cheese') or myTable:FindFirstChild('Pepperoni') then
table.clear(SpTable)
return 'Pepperoni Pizza'
elseif myTable:FindFirstChild('Tomato') or myTable:FindFirstChild('Cheese') then
table.clear(SpTable)
return 'Cheese Pizza'
end
end
function checkUp(part)
if part.Name == ‘Oven’ then
local isUsed = Instance.new('BoolValue')
isUsed.Parent = part
isUsed.Name = 'IsUsing'
isUsed.Value = false
local nbValue = Instance.new('NumberValue')
nbValue.Value = 5
nbValue.Name = 'MaxWait'
nbValue.Parent = part
local timer = Instance.new('NumberValue')
timer.Parent = part
timer.Value = 0
timer.Name = 'Wait'
local full = Instance.new('BoolValue')
full.Parent = part
full.Value = false
full.Name = 'IsFull'
local fullMax = Instance.new('NumberValue')
fullMax.Value = 3
fullMax.Parent = full
fullMax.Name = 'MaxFull'
local nbFull = Instance.new('NumberValue')
nbFull.Value = 0
nbFull.Parent = full
nbFull.Name = 'NbFull'
local cooked = Instance.new('BoolValue')
cooked.Value = false
cooked.Parent = part
cooked.Name = 'IsCooked'
part:WaitForChild('Attachment').ProximityPrompt.ActionText = 'Put Dough'
part:WaitForChild('Attachment2').ProximityPrompt.ActionText = 'Start Mini Oven'
part.Attachment.ProximityPrompt.Triggered:Connect(function(plr) -- Btn
print(plr.Name)
if plr.Character:FindFirstChild('Frozen Pizza Dough') and full.Value == false and isUsed.Value == false and cooked.Value == false then
plr.Character:FindFirstChild('Frozen Pizza Dough'):Destroy()
nbFull.Value += 1
if nbFull.Value >= fullMax.Value then
full.Value = true
end
end
end)
part.Attachment2.ProximityPrompt.Triggered:Connect(function(plr) -- Btn
if isUsed.Value == true and cooked.Value == true and nbFull.Value > 0 then
part:WaitForChild('Attachment2').ProximityPrompt.ActionText = 'Start Mini Oven'
isUsed.Value = false
cooked.Value = false
timer.Value = 0
print('yea')
for i = 1,nbFull.Value do
nbFull.Value -= 1
local pizza = game.ReplicatedStorage.Misc.Tools["Pizza Dough"]:Clone()
pizza.Parent = plr.Backpack
end
return
end
if isUsed.Value == false and cooked.Value == false and nbFull.Value > 0 then
print('start dough cooking')
isUsed.Value = true
for i = 1,nbValue.Value do
if plr.ClassSelected.Value == 'Chef' then
task.wait(.5)
else
task.wait(1)
end
timer.Value += 1
print(timer.Value)
end
print('finished dough cooking')
cooked.Value = true
part:WaitForChild('Attachment2').ProximityPrompt.ActionText = 'Pickup ' .. nbFull.Value .. ' Dough'
return
end
end)
elseif part.Name == ‘Cooking Station’ then
local folder = Instance.new('Folder')
folder.Name = 'Ingredients'
folder.Parent = part
local bool = Instance.new('BoolValue')
bool.Parent =part
bool.Name = 'Started'
local nbv = Instance.new('NumberValue')
nbv.Parent = part
nbv.Name = 'NumberIngredients'
part.ProximityPrompt.ActionText = 'Place Ingredients'
part.ProximityPrompt.Triggered:Connect(function(plr) -- Btn
if bool.Value == true and nbv.Value == 4 then
local handle = part.Handle:Clone()
local tool = Instance.new('Tool')
tool.Parent = plr.Backpack
handle.Parent = tool
handle.Anchored = false
tool.Grip = CFrame.new(-0, 0, 0.9) * CFrame.Angles(-0, -0, math.rad(-90))
local check = folder:GetChildren()
local pizzaCheck = pizzaCheck(check)
if pizzaCheck == nil then
local price = Instance.new('NumberValue')
price.Parent = tool
price.Name = 'Price'
for i, v in pairs(folder:GetChildren()) do
price.Value += 1
if i == 1 then
if v:IsA('BoolValue') then
tool.Name = 'Pizza ' .. v.Name
end
else
if v:IsA('BoolValue') then
tool.Name = tool.Name .. ' ' .. v.Name
end
end
v:Destroy()
end
else
if pizzaCheck == 'Pepperoni Pizza' then
local price = Instance.new('NumberValue')
price.Parent = tool
price.Name = 'Price'
price.Value = 15
print('give pepperoni pizza')
for i, v in pairs(folder:GetChildren()) do
v:Destroy()
end
tool:Destroy()
local pizzaPepperoni = game.ReplicatedStorage.Misc.Tools["Pepperoni Pizza"]:Clone()
pizzaPepperoni.Parent = plr.Backpack
end
end
bool.Value = false
nbv.Value = 0
part.Handle:Destroy()
return
end
if plr.Character:FindFirstChildOfClass('Tool') then
if plr.Character:FindFirstChildOfClass('Tool').Name == 'Pizza Dough' and bool.Value == false and nbv.Value < 4 then
bool.Value = true
nbv.Value += 1
plr.Character:FindFirstChildOfClass('Tool'):Destroy()
local pizza = Instance.new('Part')
pizza.Name = 'Handle'
pizza.Color = Color3.fromRGB(241, 231, 199)
pizza.Position = part.Position + Vector3.new(0,2,0)
pizza.Parent = part
pizza.Orientation = Vector3.new(0, 180, 90)
pizza.CanCollide = false
pizza.Anchored = true
pizza.Size = Vector3.new(0.2, 2, 2)
pizza.Shape = 'Cylinder'
return
end
if plr.Character:FindFirstChildOfClass('Tool').Name ~= 'Pizza Dough' and bool.Value == true and nbv.Value < 4 then
local Newingredient = Instance.new('BoolValue')
Newingredient.Name = plr.Character:FindFirstChildOfClass('Tool').Name
Newingredient.Parent = folder
nbv.Value += 1
plr.Character:FindFirstChildOfClass('Tool'):Destroy()
return
end
end
end)
elseif part.Name == ‘Fridge’ then
part.ProximityPrompt.ActionText = ‘Take Frozen Pizza Dough’
part.ProximityPrompt.Triggered:Connect(function(plr) -- Btn
if not plr.Backpack:FindFirstChild('Frozen Pizza Dough') and not plr.Character:FindFirstChild('Frozen Pizza Dough') then
local pizza = game.ReplicatedStorage.Misc.Tools["Frozen Pizza Dough"]:Clone()
pizza.Parent = plr.Character
else
print(plr.Name .. ' Has Already A Frozen Dough')
end
end)
end
end
for i, v in pairs(workspace.Cooking:GetChildren()) do
task.wait(.125)
checkUp(v)
end