How do I make a function replicate from client to server?

Have you looked at the replication tutorial ?