The problem is that you are calling a multicast event that is being called from a client. Multicast events will only run on the client if called from a client. So the object you are passing to the server function most probably does not exist on the server. What I would advice you to do is:
- On your attack function check if you are a client or the server. If you are a client call the server function, on server simply execute the code.
- Run your ray traces on the server, not on the client and apply damage accordingly on server to replicate.
- On your client simply run a simulation of the attack (particle effects, sounds, animations).
As a rule of thumb always remember that any RPC will run correctly only when called from the server. So anything you need to replicate do through a server call that then calls the corresponding RPC (in case of multicast or client), unless of course is a call to run on server.
Hope this helps as a guidance. If this info was useful please remember to mark it as the correct answer so other users can finde it easily. Make it a great day!