I can’t get the same error as you. In any event, your problems may go away when you define the function ‘more correctly’.
A function is supposed to take inputs and transform them into outputs, so it shouldn’t actually have textures inside it. It’s supposed to be a resuable piece of machinary.
PS: It is the right way to use a function, but I think there may be something a bit iffy going on, both with height maps in Alpha ( unless you specifically put them there ), and I can’t get the camera fade to do what I think it should…