Hi!
Im currently wondering about how I would go about detecting when a bullet goes close enough to a character
when the bullet doesnt hit them but is close to them, while its going through the sky
I have a bullet variable that is the fired bullet, just not sure how to go about this
1 Like
You can use Vector3 | Roblox Creator Documentation to see if it gets close enough to a character.
3 Likes
I can suggest a few ways that can get you started and thinking about how you’re going to do this.
Firstly, if you’re using rays to detect the bullets path, you can cast several more rays around it, as rays are efficient and good. A slight flaw to this may be that it’s inaccurate at times, unless you use several.
Another way to attempt this is to use magnitude, as @AxeI_c has rightfully said. This can provide you with real time info from the shot, but you’ll need to make sure the player doesn’t hear the sound and then get shot by it, or hear the sound several times while within its range. You can stop this through checking if the players already heard/ hearing the sound, raycasting, etc.
A cheaper and less effective way is to just place a sound within the bullet, and set the range you can hear it from to however big you want it to be heard from. This doesn’t give you much to customize, but if you need something quick and easy, there’s that.