How can I replicate this code?

Yep link works now. What specific parts do not replicate?
There are a few posts providing documentation on this.
Enable component replication, replicate specific properties, ensure server is owner and cause of transformations:

Simple replicated physics jittering

Component Replication | Unreal Engine 4.27 Documentation