TimePosition of LobbyMusic Resets to Zero if it has already Played Beforehand

Hio,

So a problem I’m encountering with my LobbyMusic script is that, when a randomly picked soundtrack/music is drawn from a table, it plays at my desired TimePosition (e.g. 100 seconds), but when the music thereof is drawn at random again, the TimePosition resets to zero. Note that I want my particular soundtracks to start at a specific time and constantly play at that time as it’s repeatedly drawn.

Below is my script for critique:

local LobbyMusic = game.Workspace.SoundsAndMusic.Lobby:GetChildren()
SelectedMusic = LobbyMusic[math.random(1, #LobbyMusic)]
SelectedMusic:Play()

Thanks for your input.

You gotta set TimePosition again after playing, as once it finishes it’ll default to 0. You can set it programmatically.

You may be using :Stop() instead of :Pause() when moving to the next track. Stop() will reset the time position if I recall correctly, while Pause() does not.

1 Like