How to create a "Looping" Cast. C++

I want to have this as Cpp library not blueprint. If you know how to accomplish that please tell me.
Also, this is not something controller to character specific. I want to use it in other classes that get spawned at different rates by UE but still need eachother. I’ve had this problem before with games that weren’t even multiplayer.