Hey!
The actual problem isn’t with the raycasting, but with your viewmodel.
Your issue is caused by the fact that your velocity is increasing to approximately -8000 Y for every part of your gun. This is because your gun is unanchored, and can’t be noticed since you set your gun’s position directly prior to rendering, however the position will still continuously change while the velocity is so high. Whenever it wouldn’t work for you, that meant the HitFrom part went under the baseplate from the high velocity.
Anchoring the entire viewmodel should fix the issue without affecting behavior.