Make aiming server sided

Hello! I have been developing a weapon system for a game and it has been going well, to make the aiming for weapons more realistic, I made the player torso and head face the mouse. The system works smoothly however I want to make it server sided since currently it’s client sided. How would I make a system like this server sided while not lagging out all players?

Maybe add a server script and make the client trigger an RemoteEvent if the player is aiming.

Client:

  1. Check if player has moved since you last checked
  2. Check when you previously sent the last update to the server, if it’s over a threshold, send the current look vector to the server

Server:

  1. Wait for remote fire, check if the vector sent by the client is legitimate i.e. is it a vector? is it normalised?
  2. If it meets your desired criteria, send it to all clients other than the player

Other clients:

  1. Check if the player exists within your context (i.e. if you have game streaming), check if they’re within range / view to ensure you’re not updating characters you don’t care about right now
  2. Lerp the other player’s joint coordinate frame to the new direction
  3. Repeat
1 Like