Difficult to assess without a glimpse of the actual code.
As Bill says, it’s hard to provide specific help without seeing the script in question, but I can tell you that this error comes from passing a
function value into a scripting API that doesn’t accept functions. It might be that you’re forgetting to call the function before passing it in. Apologies for the unhelpful error message!