I’m using fast cast as my projectiles, and i’m creating a visual projectile on each client, and a invisible hit detection projectile on the server. The issue is lag, what you see on your client isn’t necessarily what the server or everyone else sees.
Each part is the enemy on different clients, blue is what you see, green is what the server sees, and red is what the enemy sees. The arrow is the direction they are moving.
When you fire a projectile at the blue part, the server recreates the shot, but on the server that player isn’t there anymore, and the projectile will miss. This means that it’s incredibly hard to hit any target that is moving at all.
How can I fix this, or how can I trust the client with hit detection?
Short answer? You can’t trust client hit detection, but you also can’t fix server hit detection.
Then again, even if you could, people could still cheat via aimbot. Your best bet is to do client hit detection with some validity checks. First off keep track of the ammo on the server to prevent inf ammo exploits. Secondly keep track of the gun stats when the bullet is fired, to prevent inf damage exploits (you can do that through a dictionary and giving each bullet an ID, and server info relating to the bullet like what shot it. Store the ID in the Cast Userdata and pass it through the hit event)