I want to create a list of where the music plays for everyone in the game with the script not being as cluttered. This is basically a music controller that I want to achieve.
The problem is that I didn’t achieve that. I somehow made it as cluttered as possible so I just came here to get advice on how to fix this code or not make it have as much “elseif” statements
This is a snippet of the code I have currently:
ReplicatedStorage.GUIEvents.Music.OnClientEvent:Connect(function(music,playstop)
if music == "ReadyingUpStartup" and playstop == "play" then
TweenService:Create(SoundService.GeneralMusic.Startup.ReadyingUpStartup, TweenInfo.new(2),{Volume = 0.7}):Play()
SoundService.GeneralMusic.Startup.ReadyingUpStartup:Play()
elseif playstop == "stop" then
TweenService:Create(SoundService.GeneralMusic.Startup.ReadyingUpStartup, TweenInfo.new(2),{Volume = 0}):Play()
wait(2)
SoundService.GeneralMusic.Startup.ReadyingUpStartup:Stop()
end
if music == "NormalStartup" and playstop == "play" then
TweenService:Create(SoundService.GeneralMusic.Startup.NormalStartup, TweenInfo.new(2),{Volume = 0.7}):Play()
SoundService.GeneralMusic.Startup.NormalStartup:Play()
elseif playstop == "stop" then
TweenService:Create(SoundService.GeneralMusic.Startup.NormalStartup, TweenInfo.new(2),{Volume = 0}):Play()
wait(2)
SoundService.GeneralMusic.Startup.NormalStartup:Stop()
end
if music == "ShutdownFailed2" and playstop == "play" then
TweenService:Create(SoundService.GeneralMusic.EmergencyShutdownOrRestart.Failed.ShutdownFailed2, TweenInfo.new(2),{Volume = 0.7}):Play()
SoundService.GeneralMusic.EmergencyShutdownOrRestart.Failed.ShutdownFailed2:Play()
elseif playstop == "stop" then
TweenService:Create(SoundService.GeneralMusic.EmergencyShutdownOrRestart.Failed.ShutdownFailed2, TweenInfo.new(2),{Volume = 0}):Play()
wait(2)
SoundService.GeneralMusic.EmergencyShutdownOrRestart.Failed.ShutdownFailed2:Stop()
end
end)