Over the past year or so, I have been developing a 'wand' projectile system.
The system I made would work by: Player Equips Wand, Player Clicks Mouse, Local script connect to a remote event sending the position of the mouse.hit as well as the tool, The server then receives the message, Server creates the spell, Server then fires the spell via raycasting.
However, I was recently pointed out that by firing it over the server and allowing the server to execute all of it, including the movement; It could create latency on the server as it's high demand, especially if there are a lot of player.
They then suggested to me about using 'FireAllClients'.
My first question, how does manipulating the projectile through the clients rather than the server create less latency?
Second question, how would the server know when the projectile has hit an object if all players are firing this projectile?
Third question, due to the projectile being fired under client conditions and not server, if an exploiter came along, could they move their client sided projectile to hit a different position and have a different hit outcome? Eg. Instead of spell hitting the wall, it hits a player instead?
If anyone could explain the benefits of FireAllClients rather than doing this all server sided, I would be really appreciative of it...
If possible, could you give a method on how the FireAllClients could be used within a projectile circumstance.
Eg. Dev Forum thread:
ClientA fires a Event telling the Server to make a Projectile Part on all of the clients, FireAllClients, Clients have a OnClientEvent that creates a Projectile Part with the Position Argument passed from the server (The RootPart’s Position of the Player who fired the event in Step 1), Clients use Region3 to detect if the Projectile has hit something, if it did Destroy the Part, If the Client is the same as ClientA that fired the Event in Step 1 and the Projectile Hit something, Fire a event with the Position Argument that the Region3 detected a Humanoid at and make a Region3 on the server to validate that there is something hitting the Region3 at that Position.
If you have any other better methods, please let me know!
Thank you!
