Hello, I’m currently trying to figure out how would I go about creating a gun system that responds instantly, I know it’s easier to do a system that’s server sided, but with server sided systems, the issue is it is delayed due to server ping, which makes the experience less fun.
I’m aware that you can use something like the FastCast module, and it is designed for client to server replication, but I can’t seem to find a good answer on how to achieve that, mostly I only find tutorials that mostly use server sided stuff.
How can I go about making a system using client to server replication?
Detect input on the client with UserInputService or ContextActionService
If a gun is equipped, use fastcast to make client side visuals of the bullet(that serve no other purpose than effects), while sending the hit position of your mouse at the same time through a remote event.
Server recieves the hit position and does sanity checks like doing it’s own raycast, checking if the player can fire the gun, maybe a little lag compensation, etc.
If shot is valid then damage the target’s health accordingly
When the server register’s a hit for ClientA(example name), then the server can use a remote event to send visual data Ex. (StartPosition, EndPosition, A Name lookup in a modulescript for more specific visual information to reduce network usage) to each client except ClientA or the player who fired the gun, then when every other client recieves the start, end and a lookup key, they recreate the shot for their own client.