Help with gun system latency

So, I’m trying to implement a gun system right now, but there seems to be a noticeable latency in each gun fire event to the actual replication of bullets on the server. When I shoot in full auto, the bullet holes fall far behind where my crosshair is on the screen while I’m moving. What I’m trying to replicate is something similar to phantom forces’ shooting system where there is seemingly no latency from click to visible bullet spray hitting walls.

The system I currently have implemented is the click recognition is happening on the client, then it fires an event to the server with all needed parameters (mousePos, CFrames, etc) and then the server handles the raycasting and checks what was hit. Any recommendations on how I could speed up the process?

Games likely Phantom Forces circumvent this delay by raycasting on the client. This instantly solves the latency issues, but introduces a ton of security risks, which is the reason exploiters are capable of instantly killing all opponents using aimbot in games such as Phantom Forces.

You can either choose to keep it secure on the server, and live with the delay. Or move it to the client, but risk exploiters running rampant. Or you could strike a middleground where the client does the raycasting but the server verifies the hit. The last option is by far the most ideal, but also the most complex.

2 Likes

exactly what I do for gun systems, use this method to make a good gun system.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.