When working with UE5 code, one powerful tool is the delegates system which also drives the event dispatchers in blueprints. This tutorial goes over how they work, how to set them up in code and how to expose them to the editor. You will also see how the TFunction works as well as the Blueprint Implementable Event and Blueprint Native Event UFUNCTION tags work
https://dev.epicgames.com/community/learning/tutorials/q7yl/unreal-engine-what-are-delegates-event-dispatchers-ue5-c-tutorial