Bug with LookVector and Raycasting

Hi there!

I created a simple gun script where the player fires a gun using raycasting, which is fired from the barrel of a gun. The bullets will fire towards the general direction of where the mouse/crosshair would be.

I now experienced an unusual bug where the LookVector or RayCast is off by a large margin when the player shoots and moves. How do I fix this?

The bullet trail effect is Local
The raycasting is Server

1 Like

Please provide your scripts or piece of code that manages the raycasting and display of the trail so that I can help.

1 Like

I will provide the entire model.
More details on how to replicate this bug: Just run backwards or backwards and left or right key while shooting at the general direction.

GUN RAYCAST.rbxm (7.4 KB)

1 Like

i think it is normal because the raycast was made on the place the player was located earlier and the raycast doesnt move with the player

I have references to other gun scripts, and those scripts do not replicate nor did it offset the rays like mine did.

then i have no clue to fix this! im not the best at raycasts.