How to add a delay in a function?

A function has a call stack, which means it needs to finish running and returning before anything else can run. (Blueprints do not have coroutines.)
The “delay” node in an Event Graph is syntactic sugar for “set a timer, then call back some event when that timer is done, and continue running some other event” where that “some other event” ends up being the output pin of the “delay” node.
If that’s the action you want to do, you can manually set that up in the function, but beware that the “after delay” action must be an event, or a function. (Set Timer by Event or Set Timer by Function or maybe Create Event from Function followed by Set Timer by Event)

2 Likes