Should I fire raycasts on the server or client for an FPS game?

So basically, I’m making an FPS game but I don’t know whether to make the raycasting on the server or client, with the server it makes it impossible to shoot through walls etc, but comes with input delay / server lag and with the client its easily cheatable but with way less lag for the server and player.

I know that if I made the raycasting on the client I could do sanity checks but I don’t know how do to that.

Its better to do it on the server as the Server (On certain occasions) does not recognize changes from the client.

I may be wrong tho

You want to negate errors with internet latency, so you should be cutting the middle man and let server do the work now. Server shoots the raycast, while player locally plays their gun animations and such. (Server plays animation that doesnt automatically replicate, like player animations using :LoadAnimation ()

1 Like

You do it on both.
You can raycast on the client, and only if you get a hit on the client, send an event to the server
then the server can do its own check.