How do I replicate a material from an object on the server to the corresponding object on the client?

The only way I could replicate a material was by doing it in blueprints. I could not get a dynamic material created in C++ at runtime to work.