Please help why is my gun system lagging?

So when not in studio I have a few milliseconds to a second delay. This video explains it all:

plz help me fix this plz plz plz ik i stole a mesh from r2da dont bash me ok and i didnt activate windows cuz im poor

2 Likes

Those few milliseconds of delay are a result of the client sending data to the server. With this, I’m inferring you’re letting the server handle creating the bullet and getting the client’s mouse data to fire it towards that 3D position. This isn’t necessarily traditional lag, though it is still delay.

If you want to make it unnoticeable for the client, you’ll have to apply the creation of the bullet on the client side. After the bullet hits something, it can then fire that to the server. For the bullet to replicate to other clients, just fire a RemoteEvent to all the clients except the player who fired.

Of course, this is definitely not secure, but it can be a bit more protected if you incorporate some sanity checks in your server script. There’ll also be delay on damaging players (unless you apply that to clients as well, though I doubt you would or should) but that’s pretty much unavoidable.

TL;DR: Your gun system is “lagging” on the normal Roblox player because the client is firing data to the server through a RemoteEvent. To fix, do bullet framework on the client.

6 Likes

ok thx i’ll try this and if it works i will be very happy