Delay infinite loop errors

I have a infinite loop using delay.

image

However this errors with “delay function requires two arguments”.

(it still works however it errors every single time it runs and I want a clear console)

Any help?

which delay() is it talking about?

The second delay inside the function

does the error come up if you make DelayApple a local function?

local function DelayApple(Tree)

It still errors even as a local function

could you send the code so I can try something

how do I send it with the lua format?

three backticks at the top and bottom of the code

local function DelayApple(Tree)
	delay(math.random(1,3),
		function()
			if Tree:GetAttribute("State") == "Normal" then
				GrowApple(Tree)
				delay(math.random(1,3),DelayApple(Tree))
			end
		end
	)
end```
function DelayApple(Tree)
    delay(math.random(1,3),
        function()
            if Tree:GetAttribute("State") == "Normal" then
                GrowApple(Tree)
                delay(math.random(1,3),
                    function()
                        DelayApple(Tree))
                    end
                )
            end
        end
    )
end

tell me if this works, also sorry it took forever, mobile takes forever to add indentation

Thank you so much! This works well