Get RayCast Direction

Hello!

I am working on making my guns more secure, and i have already implemented damage, fire rate and distance checks but how can i check if the player is facing in the same direction as the target? I have a cursor lock in my guns so the player is always facing the direction they’re aiming, so is there some sort of property to get the direction or the Ray?

Thanks

I thought you needed to know the direction in order to cast the ray?

Nevermind, it was a dumb question.

This check will kind of be bad for laggy players, because lets say your playing a fast paced fps, and you shoot someone quickly and then turn to another direction to shoot someone else, for laggy players the server would disregard the previous shot.