RayCast is different Server vs Client!

I think I know what you’re going for, but you may run into issues with responsiveness and unsynchronised variables (as a result of latency). It’s entirely possible that the client’s view and the server’s view are not 100% the same. Are you replicating the client’s view to the server? If not, the server might have a different idea of the exact start and end positions of your line trace, based on its local representation of the client. However, replicating the client’s view isn’t entirely necessary (actually, you would typically pass the client’s local view data through an RPC whenever they want to fire, rather than making it a replicated variable) if you aren’t going for server-side hit detection (where the server processes all shots and hits. Ensures optimal experience for low-ping players, but really shafts anyone with slightly higher ping as it will feel unresponsive or inaccurate based on their view). It looks like you want to make a shooter. I usually perform line traces (weapon firing) like this to ensure that clients feel responsive (also known as client-side hit detection, server validation):

Perform the shot locally on the client (including visual effects), which generates a hit result. You then pass the hit result through to the server (along with the start trace vector and end trace vector) as an RPC. You can then do some clever stuff to verify the shot and whatnot to limit lag compensation, but you would mostly just process the hit and transmit the damage through to the hit actor. This client-side hit detection approach is used in Overwatch, for example. Games like Battlefield 1 use a hybrid approach where anyone with ping below 150 (I believe?) is given client-side hit detection rights, while anyone above 150 has their hit detection handled server-side (to avoid shooting low-ping players when they have moved behind cover on their screen). Like I mentioned, the server-side approach puts a major disadvantage on higher-ping players (they need to lead their shots more and fire ahead of where players are on their screen to receive a hit). This is why I personally prefer client-side hit detection. You might get shot when moving behind cover now and then by higher-ping players, but it ensures that the majority of players will have a good overall experience, especially if they’re playing from regions that don’t have local servers.

So, if you want to move to client-side hit detection instead of your server-side approach, here’s usually how I do it (if anyone else has a better approach, please let me know. I’m by no means an expert):
Perform your shot locally. Play the correct visual effects, anims, and whatnot. Then, pass the hit into an RPC function like this:

ServerVerifyShot_Implementation(const FHitResult& Hit, FVector ShotDirection, FVector TraceEnd)

Then, if you don’t want to perform extra verification, just apply the damage to the hit actor inside of here (and play the required visual effects if it isn’t a dedicated server)
UGameplayStatics::ApplyPointDamage(Hit.GetActor, Damage, ShotDirection, Hit, MyOwner->GetInstigatorController(), this, DamageType);

Replicating fire effects is a different challenge, but you can find that pretty easily on good ol’ Google. There are a few approaches.

Let me know if this helped!