So, I'm making a game and it has these songs that play depending on the value of a BoolValue in ReplicatedStorage, this is my code:
local sound = script.Parent.Ambient
local sound2 = script.Parent.Combat
local value = game.ReplicatedStorage.Combat
if value.Value == false then
sound2.Volume = 0.5
wait()
sound2.Volume = 0
wait()
sound2:Stop()
sound:Play()
sound.Volume = 0.5
wait()
sound.Volume = 1
else
sound.Volume = 0.5
wait()
sound.Volume = 0
wait()
sound:Stop()
sound2:Play()
sound2.Volume = 0.5
wait()
sound2.Volume = 1
end
I want the script to run everytime the value changes to either true or false. Notes: I have attempted the Changed event, but it did not work at all. (It doesn't play any song). If I use "while wait() do" then it'll just keep playing the song from the start. EDIT: Ok, I hope the script is proper now. Anyways, I said in the notes that I have used the Changed event, but it doesn't work. No song is playing, even when changing the value.

5 comments
Learn indenting and don't use while wait() do, you don't even know how and why that idiom works
Hes clearly new at coding, give him a break.
No. There is not an excuse to not indent.
indent pls
also use a changed event