I'm trying to add Lobby and Game music to my new game - 'Ray Catcher' - title work in progress, but for some reason, the lobby music keeps cutting off, and not changing to a new song. All the songs are in a folder in Workspace, one folder for game music, one for lobby music, but I'm only able to test LobbyMusic at the moment.
-- this is repeated every second if not CurrentLobbySong or not CurrentLobbySong.IsPlaying then print("1", CurrentLobbySong) if CurrentGameSong then print("2", CurrentGameSong) else print("3",CurrentLobbySong,CurrentGameSong) local t = 1 repeat newSong = lobbyMusic[math.random(1,#lobbyMusic)] t = t - 1/30 wait() until t < 0 or newSong ~= CurrentLobbySong CurrentLobbySong = newSong CurrentLobbySong.Stopped:connect(function() CurrentLobbySong = nil end) CurrentLobbySong.Ended:connect(function() CurrentLobbySong = nil end) CurrentLobbySong:Play() print("4",CurrentLobbySong,CurrentGameSong) end else print("5",CurrentLobbySong,CurrentGameSong) end
This is in a Server Script, and it works fine in Test mode, but when I play it online, it recognises 'CurrentLobbySong' is a song, will show IsPlaying as true, but the TimePosition doesn't update, nor does TimeLength, even though the music is playing. Even when the music stops online, it won't call the Stopped/Ended function.
Any help or knowledge in this area would be most appreciated.