local LocalPlayer = game:GetService("Players").LocalPlayer local NextSteps = LocalPlayer.PlayerGui.ScreenGui.NextSteps local Steps = NextSteps.Steps local CurrentAction = NextSteps.CurrentAction local function GetCurrentTask() if CurrentAction.Value == 0 then return false end return Steps[tostring(CurrentAction.Value)] end warn(Action) local function GetIngredients(CurrentTask) local TempIngredients = CurrentTask.Ingredients:GetChildren() local Ingredients = {} for i,v in pairs(TempIngredients) do if v.ClassName ~= "Frame" then continue end local Ingred = v.ViewportFrame:FindFirstChildWhichIsA("Model") if v.Name == "Ingredient" and Ingred then table.insert(Ingredients, Ingred.Name) end end return Ingredients end local function GatherIngredient(dum, IngredientName) task.spawn(function() local args = { [1] = IngredientName } game:GetService("ReplicatedStorage"):WaitForChild("LocalModules"):WaitForChild("LMKitchen"):WaitForChild("ServerRec"):WaitForChild("ObtainFood"):InvokeServer(unpack(args)) end) end while wait(.1) do local CurrentTask = GetCurrentTask() local Action = CurrentTask.Action.TextLabel.Text warn(Action) if Action == "Pantry" or Action == "Fridge" then table.foreach(GetIngredients(CurrentTask), GatherIngredient) end end