(ENTIRE CODE PASTBIN AT THE BOTTOM)
Hello,
Currently I have a SWEP that includes a scope with X-RAY capabilities, in Singleplayer and as the server host, the scope works just as intended with no problems.
However, my friend (who is a client on the server with considerably high latency) reports that when Unzooming from the scope, the overlay and X-RAY effect will linger for up to 5 seconds before going away.
I am assuming this very much has to do with lag and such but I haven’t the slightest on how to resolve it.
Am I close by assuming this has to do with Prediction?
If anybody could show me what’s going on, I would very much appreciate it.
Thank you for your time.
Here is the relevant code to the scope.
How it is triggered.
Scope Function.
X-RAY Function
Viewmodel and Sensitivity.
and the overlay
ALSO: The X-Ray function is called inside of SWEP:Think()
If you want to look at the entire code, here’s that too: