You can delay the gunshot sound and play a whizzing sound locally as the bullet passes by the character.
You can calculate how long to delay the gunshot sound based on the distance between the character and the gun.The time you need to delay the gunshot by is equal to the amount of time it would take the sound to reach the character.
v = d/t
t = d/v
Where t is the time the sound would take to travel the distance d at velocity v.
Now, using this information:
-According to the Roblox Blog, 20 studs = 1 meter
-The speed of sound in air is ~343 meters per second
Let’s call the distance between the character and the barrel of the gun in studs d, which can be calculated as:
d = (Character.PrimaryPart.Position - Barrel.Position).Magnitude
That means that the time you need to delay the gunshot sound by is:
T = d / 20 / 343
At this point, you should realize that this time is insignificant, because in the scope of a Roblox game, the distance between the gun and the character is unlikely to exceed 100 to 1000 studs, and at a distance of 100 studs, the delay would only be 0.0146 seconds, which is less time than it takes to render a single frame at 60 fps, and at a distance of 1000 studs, it’s only a 0.146 second delay, which is still incredibly small given all of the other factors you have to account for, such as any empty time at the beginning of the gunshot sound or whizzing sound, latency, etc.
In other words, this is probably not worth your time to create, unless you’re planning on making some sort of game with long range sniping at distances that would likely exceed the client’s render distance, or unless you’re not planning on following real-world physics.