Right now, my raycasts are a simple; player clicks -> remote event fired -> raycast created
because that is super duper exploit proof!
the thing is, there is a slight “inaccuracy” with the raycasts, and i wanted to ask how i can make my raycasts pinpoint accurate whilst being exploit-proof, as the title suggests
From what i believe, there isnt a possible way to get thr player’s mouse without using a remote event that is exploitable. I have no idea what you plan to do with those exploits but if, for example, it was a FPS game then go from thr head to the area where the mouse clicked.
If you just want somewhere to start, this is one way you can implement a verification system:
You cast a ray locally when needed (like when a user is shooting a gun) and do all your client visuals locally. You then send a remote event into the server with relevant data like your RaycastResult, the Ray’s Origin and the Raycast Parameters as the parameters. You then cast a ray on the server and see if it hit what the local ray hit.
In short form: player clicks -> cast ray locally -> remote event fired -> cast identical ray on the server -> compare and verify
There will be latency, but as long as you send identical data, you should get near identical results (If the player doesn’t hit the same target, you probably shouldn’t act upon the ray). The method I’ve shown may not be the most accurate in terms of predicting where the target will go and correctly scan accordingly, but this method is the most simple form of server-side raycasting and should prevent client exploits that involve manipulating the environment locally to guarantee hits on a target.