I’m trying to make a part that continuously looks towards where the player is pointing their mouse and I want it to be server-side. The only way I understand to accomplish this is by firing multiple RemoteEvents each second but it seems like a very inefficient solution to what doesn’t appear to be the most complicated problem.
If it is the only solution, how many RemoteEvents can one reasonably fire every second (assuming the one parameter is a just an integer) without it affecting the performance too much?
If you script running only on server (it’s not fired by RemoteEvent or RemoteFunction), you can fire one RemoteFunction to get mouse data per your script tick. Also you I want to say that you can use player:GetMouse() only on client-side.
I read this blog post a while back and ended up using UnreliableRemoteEvents for positioning a cannon towards a player’s mouse position in world space. Pairing Linear Interpolation w/ UnreliableRemoteEvents for things like this is HIGHLY slept on.
This is what I was hoping to do to begin with. I discovered you can’t set network ownership of anchored parts however so it wouldn’t work unfortunately.
If you do end up running into performance issues, you can move the CFrame updates to the Clients and have them handle the interpolation and what not. I did this but, it’s very important that you only send the rotational data calculated on the client to the server so they can’t mess w/ positioning. From there, validate and broadcast said changes to the other clients via an UnreliableRemoteEvent.