Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I control audio range?

Asked by
GShocked 150
9 years ago

I have a Part which has a Sound item in it, as well as a Script that runs the Sound item. I have a movie theater that plays videos on the screen and 4 speakers per auditorium. I'd like to know how I can prevent all the audio in the game from overlapping each other.

So is there a way to set the range of audio (Kind of like setting the range of a light)?

1
Are they playing at the same time? If they are, you have to script it so that its for the local player in every auditorium. You dont want multiple sounds to be playing in the workspace. TrollD3 105 — 9y
0
@TrollD3 That would fix the overlapping audios. GShocked 150 — 9y

2 answers

Log in to vote
3
Answered by 9 years ago

Since this is not a request site I will just tell you how to do it, but not give you the script. The way I know would work is if you have a script in the speaker that checks if players are within the max distance to be able to hear it using magnitude. If the player is within the distance it should check if the player already has the sound in his PlayerGui, if not then it should create the sound and play it at the same time position as the main sound (you will have to set the volume to 0, put it in workspace and play it). If you attempt to do this and it doesn't work, create another post but with your attempt and I will help you out. Please vote up and accept as answer if this helps!

0
Thanks, I'll accept this as an answer and provide the script I made using it in a different answer. GShocked 150 — 9y
Ad
Log in to vote
0
Answered by
GShocked 150
9 years ago

This is the final result that works for me!

wait(3) --Wait for the game to load, increase on slower computers (or find other fix)
local player = script.Parent.Parent.Parent.Character.Torso
screen = game.Workspace.Screen2
while true do
    if (screen.Position - player.Position).magnitude > 105 then --105 bricks away
        script.Parent.Audio2.P1.Volume = 0 --Mute
        script.Parent.Audio2.P2.Volume = 0
    else
        script.Parent.Audio2.P1.Volume = 0.25 --Otherwise volume 25%
        script.Parent.Audio2.P2.Volume = 0.25
    end
    wait()
end
0
That's great! Good job, I'm glad it worked for you. General_Scripter 425 — 9y

Answer this question