How can you script your game so that when ever you enter a different area/portion of the game, a different audio file plays ambiently and locally?
✓ ANSWER ACCEPTED
[RESOLVED] How to make ambient sounds zone based?
1 answer
✓ Accepted answer
There are 2 ways that you can go about doing this.
- Region3 Use FindPartsInRegion3 to check if the player is in a region3, if so, play the local ambient sound.
- Distance from a center Have a Vector3 value as a center of your "zone", if the player's torso is positioned within the radius of the zone, play the sound. To get the distance between 2 Vector3s, get the magnitude of the difference of the two Vector3s. e.g,
local Vec1 = Vector3.new(0,0,0)
local Vec2 = Vector3.new(0,5,0)
print((Vec1-Vec2).magnitude)
I personally prefer the second method. For no particular reason. You should read more about Region3 on the wiki to use the first method.
This discussion is preserved as it was. New answers, comments, and votes are closed.
