Selective Replication

I am remaking a gun that previously has all of its code in a local script. This works very well and is very responsive. The problem is that it is not replicated to the server. I tried previously to make it server sided, but that lead to delays and made the gun slow. (i.e. I would click and then half a second later the gun would fire). This got me thinking.

I was wondering if I could have a server side version of the gun that everyone else will see, but the player will still have the client side version that is smooth. (Have the server replicate to everyone except one person)

There is a compromise to this, where I make my own replicator with remote events (fire from the main player to the server, then fire from the server to everyone else that actually shows the gun.)

I am wondering what is best. All input is appreciated.

I think most gun systems do that. They have two versions of the gun, one used for the client perspective(that is often in first person mode) and one for everyone else perspective. They also have to deal with other things such as validating shots, handling lag, catching exploiters, etc.

I have heard of that, and want to see if that is possible in Roblox.

The main issue if I’m not mistaken will be to show the “server gun” to other players but not the client itself. That’s because if you add the server gun directly to workspace it will be automatically replicated to that client as well. A fix for that is to either allow it to replicate and instantly delete it if it’s their own gun, or “create” the server gun on the client(well the other clients), according to the “creation data” you send to the server(it can be something as simple as moving the gun from a folder to another, but on the client).