I have a problem where if a pizza has 3 toppings, it doesn’t always set all 3 toppings to be done, and thus CurrentPizza.Complete.Value never gets set to true
local function checkPizza()
local HasCheese = false
local HasSauce = false
local HasTopping1 = false
local HasTopping2 = false
local HasTopping3 = false
if CurrentPizza:FindFirstChild('Cheese') then
HasCheese = true
end
if CurrentPizza:FindFirstChild('Sauce') then
if CurrentPizza.Sauce.SauceType.Value == CurrentSauce then
HasSauce = true
end
end
if #Toppings > 0 then
if #Toppings >= 1 then
if CurrentPizza:FindFirstChild(Toppings[1]) then
HasTopping1 = true
end
if #Toppings == 1 then
if HasCheese and HasSauce and HasTopping1 then
CurrentPizza.Complete.Value = true
speedUpConveyor()
end
end
if #Toppings >= 2 then
if CurrentPizza:FindFirstChild(Toppings[2]) then
HasTopping2 = true
end
if #Toppings == 2 then
if HasCheese and HasSauce and HasTopping1 and HasTopping2 then
CurrentPizza.Complete.Value = true
speedUpConveyor()
end
end
if #Toppings == 3 then
-- If there are 3 toppings, this section of code doesn't always run?
if CurrentPizza:FindFirstChild(Toppings[3]) then
HasTopping3 = true
end
if HasCheese and HasSauce and HasTopping1 and HasTopping2 and HasTopping3 then
CurrentPizza.Complete.Value = true
speedUpConveyor()
end
end
end
end
else
if HasCheese and HasSauce then
CurrentPizza.Complete.Value = true
speedUpConveyor()
end
end
end