How would i be able to make bullet whiz

hello, how would i be able to make bullet whiz for bullets, i have no idea where to start or how to do it
ive tried a module called whizzy bullets on a past project but it would lag everyones pc a lot, if someone could tell me how to make the sound play myself or use that module i would be thankful

1 Like

Do you mean just the difference in volume, or something like a Doppler effect, where the frequency distorts based on the distance from the listener?

1 Like

no, when the bullet passes by the player it makes a sound effect, if i just add a sound on repeat in the bullet object it would not work

1 Like

Simply put, you can check if the bullets trajectory passes NEAR a player, and if so figure out the speed of the bullet, the distance of the player and play the sound at that exact time.

It will take a bit of understanding math, but this will give you the effect you want.

1 Like

Just have the wizz sound play whenever a bullet gets within a certain distance of a players head

or you can make an 5,5,5 invisible cube(non collidable), make players spawn with this cube exactly where their heads are and keep them there (doesnt matter how its done) then just run a touch function on the cube for bullets

2 Likes

Put a sound in the bullet, but you can make the sound playing= false, and create a spherical hitbox around the bullet detecting if it touches a player. If it does, then set the sound.playing to true and back to false upon leaving the touched event, all client-sided.

2 Likes

Sorry, I didn’t see your post lol, but that’s basically what I was saying

1 Like

I think if you want to detect whether or not a bullet is close enough to a player you could represent the bullet as a ray with the ray’s origin being the muzzle or whatever and the direction being the direction it’s going. After you create that ray you can loop through all the players and use Ray:ClosestPoint(player head position). Subtract the closest point and the position of the player’s head and you should be able to find the distance between the player’s head and the bullet. You can use that distance to figure out whether or not to play the whizz sound effect and add camera shake or whatever.

1 Like

well this only works if your bullet is raycasted or really fast and not an actual projectile

i dont really trust .touched events, since my bullets behave really fast they collisions will not register
besides that i tried my way and manage to make something i need to test it still tho

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.