Sound doesn't play?
So i have a music that plays in during a battle. In the first battle it works, but when the second battle happens, the music doesn't play. I noticed that when the second battle is happening, IsPlaying in the battle music is true. What happens? It works correctly. When the battle music has to stop, the script stops it. And when it plays, it plays. But for some reason when it plays in the second time, the sound doesn't play, but the script prints that the battle music played and IsPlaying is set to true.
01 | local LevelMan = game.Workspace:WaitForChild( "Level Manager" ) |
02 | local GS = LevelMan:WaitForChild( "GameStarted" ) |
03 | local IIL = LevelMan:WaitForChild( "IsInLobby" ) |
04 | local Lobby = script:WaitForChild( "Lobby" ) |
05 | local Battle = script:WaitForChild( "Battle" ) |
07 | function PlayStopSound(sound,play) |
09 | print ( "Sound Manager: Playing " ..sound.Name) |
12 | print ( "Sound Manager: Stopping " ..sound.Name) |
19 | local function PlayLobby() |
20 | if IIL.Value = = true then |
21 | PlayStopSound(Lobby, true ) |
23 | PlayStopSound(Lobby, false ) |
27 | IIL.Changed:connect( function () |
31 | local function PlayBattle() |
33 | if GS.Value = = true then |
34 | PlayStopSound(Battle, true ) |
36 | PlayStopSound(Battle, false ) |
40 | GS.Changed:connect( function () |