I have made a multiplayer game using netcode for game objects. Now, I want to implement knockback in my game, I have a shoot script in which I raycast and get the info of the player I am hitting (the game is 1v1 3D fps shooter) but I am not able to move the player from the script. I mean I tried firing events or calling the method of that player’s script but none of it work also I don’t have much knowledge about rpc’s so can anyone please guide me on how I can implement this in details like what I should call on server or client rpc etc. It is the last feature and my game will be complete for the college project and it will be very helpful and I will be really thankful for all the replies.
Without seeing the script we can’t tell what could be improved or why it fails.
If the object has a NetworkTransform, only the server can modify its transform. The server should also be the one running the raycast. Which means when you fire, you send an RPC to the server with the Ray for the server to handle the pushback.