Hey, I am making a main menu that when you press play the sound goes from its current sound to 0 smoothly. The issue is that it makes the alarm go from 0.25 to 0 which is what I want but the main theme sound lowers but not completely.
Anyone know why this is?
local MainMenu = script.Parent
local PlayButton = MainMenu.PlayButton
local Alarm = script.Alarm
local MainTheme = script.MainTheme
Alarm:Play()
MainTheme:Play()
PlayButton.MouseButton1Click:Connect(function()
spawn(function()
for i = Alarm.Volume, 0, -0.05 do
Alarm.Volume = i
wait()
end
end)
for i = MainTheme.Volume, 0, -0.05 do
MainTheme.Volume = i
wait()
end
end)
Edit: I tried to make a different thread to fix this (spawn()
) but this had no effect.
This pretty strange. Is this a local script or normal? I assume local.
I tested it and it worked fine.
Local of course. (more for character limit)
I think the issue is you may be making the audio sound go down too fast (possibly)(.
Also, when I added spawn(function() it made the local script NOT work.
Yeah I removed the spawn(). (limit of character)
Also, you are making the theme song audio go down, not sure if you want that but that may be the issue.
It still has the same problem… Idk what is happening!
Yes I want it to go down to 0.
So you want both to go down ? .
Yes. It is for a mainmenu and the music is just for that menu so when you click play they are ment to stop playing.
So both of the audio’s volume doesn’t change at all?
No the alarms volume works fine, its just the main theme.
Are they both the same volume from the start?
No, the maintheme is 1 and the alarm in .25.
Well it is waiting for when the first one finishes to do the second one. (Which you already know because you added spawn(function()).
Add a print statement to the loop to see what its doing. Also, why not stop() the sounds after you ramp the volumes down? (that will surely stop them, no?)
1 Like
Yes I know that. But I don’t think that would affect why it would just not go to 0.
I already tried that and it doesn’t print for me.
I want it to go smoothly to 0, not just stop instantly.