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:
- Check if player has moved since you last checked
- 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:
- Wait for remote fire, check if the vector sent by the client is legitimate i.e. is it a vector? is it normalised?
- If it meets your desired criteria, send it to all clients other than the player
Other clients:
- 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
- Lerp the other player’s joint coordinate frame to the new direction
- Repeat
1 Like