My music script always plays fallback playlist

Hello,
In my new script, I have a fallback playlist to play when something’s wrong.
But my music script always plays fallback playlist, and I really need help because it’s annoying.

I wanted to get rid of the if-then-elseif statements because I do not like them, and make the fallback playlist the 2nd one, the “observing” playlist.

Old, working script
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1.5)

local musicPlaylists = game.ReplicatedStorage.Audio.Music
local currentTrack = nil

local currentPlaylist = "intermission"
local currentTrack: Sound

local TimeTypeRemote = game.ReplicatedStorage.TimeType
local TimeRefreshRemote = game.ReplicatedStorage.TimeRefresh


TimeTypeRemote.OnClientEvent:Connect(function(timeType) -- 1 = intermission, 2 = inRound, 3 = inEnd

	if timeType[2] == 1 then
		currentPlaylist = "intermission"
	elseif timeType[2] == 2 then
		currentPlaylist = "observing"
	elseif timeType[2] == 3 then
		currentPlaylist = "building"
	elseif timeType[2] == 4 then
		currentPlaylist = "end"
	end

	pcall(function()
		local tween = TweenService:Create(currentTrack, tweenInfo, {Volume = 0})
		tween:Play()
		tween.Completed:Connect(function(playbackState: Enum.PlaybackState) 
			currentTrack:Stop()
		end)
	end)
end)


while task.wait() do
	currentTrack = musicPlaylists[currentPlaylist]:GetChildren()[math.random(1, #musicPlaylists[currentPlaylist]:GetChildren())]
	currentTrack.Volume = 0
	currentTrack:Play();
	local tween = TweenService:Create(currentTrack, tweenInfo, {Volume = 0.5})
	tween:Play()
	currentTrack:GetPropertyChangedSignal("Playing"):Wait()
end
New, broken script
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1.5)

local musicPlaylists = game.ReplicatedStorage.Audio.Music
local currentTrack: Sound
local timeType = nil

local fallbackPlaylist = timeType[2][2]

local TimeTypeRemote = game.ReplicatedStorage.TimeType
local TimeRefreshRemote = game.ReplicatedStorage.TimeRefresh


TimeTypeRemote.OnClientEvent:Connect(function(timeType)
	--[[
		timeType[1]:			1		|		2		|		3		|	4
		timeType[2]:	"intermission"	|	"observing"	|	"building"	|	"end"

		if timeType[1] is 3, timeType[2] is "building".
	]]--

	timeType = timeType
	pcall(function()
		local tween = TweenService:Create(currentTrack, tweenInfo, {Volume = 0})
		tween:Play()
		tween.Completed:Connect(function(playbackState: Enum.PlaybackState) 
			currentTrack:Stop()
		end)
	end)
end)


while task.wait() do
	currentTrack =
		if timeType ~= nil then
		musicPlaylists[timeType[1]]
		:GetChildren()[math.random(1, #musicPlaylists[timeType[1]]:GetChildren())]
		else
		musicPlaylists[fallbackPlaylist]
		:GetChildren()[math.random(1, #musicPlaylists[fallbackPlaylist]:GetChildren())]

	currentTrack.Volume = 0
	currentTrack:Play();
	local tween = TweenService:Create(currentTrack, tweenInfo, {Volume = 0.5})
	tween:Play()
	currentTrack:GetPropertyChangedSignal("Playing"):Wait()
end
Script diff

Please help.

Try making it so the pcall returns the success along with the message (if you haven’t already done that)

If there is an error that causes the script to play the fallback music, print the message variable returned by the pcall so you can see what causes it to go to fallback

I’m sorry, I posted the wrong part of the script. I edited my OP.

Also what you said is just not true

Fixed! Was just a dumb oversight.

Final script:

local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1.5)

local musicPlaylists = game.ReplicatedStorage.Audio.Music
local currentTrack: Sound
local timeType = nil

local fallbackPlaylist = "Observe"

local TimeTypeRemote = game.ReplicatedStorage.TimeType
local TimeRefreshRemote = game.ReplicatedStorage.TimeRefresh


TimeTypeRemote.OnClientEvent:Connect(function(newTimeType)
	--[[
		timeType[1]:			1		|		2		|		3		|	4
		timeType[2]:	"Intermission"	|	"Observe"	|	"Build"		|	"Checking builds"

		if timeType[1] is 3, timeType[2] is "building".
	]]--

	timeType = newTimeType
	pcall(function()
		local tween = TweenService:Create(currentTrack, tweenInfo, {Volume = 0})
		tween:Play()
		tween.Completed:Connect(function(playbackState: Enum.PlaybackState)
			currentTrack:Stop()
		end)
	end)
end)


while task.wait() do
	currentTrack =
		if timeType ~= nil then
			musicPlaylists[timeType[1]]
				:GetChildren()[math.random(1, #musicPlaylists[timeType[1]]:GetChildren())]
		else
			musicPlaylists[fallbackPlaylist]
				:GetChildren()[math.random(1, #musicPlaylists[fallbackPlaylist]:GetChildren())]

	currentTrack.Volume = 0
	currentTrack:Play();
	local tween = TweenService:Create(currentTrack, tweenInfo, {Volume = 0.5})
	tween:Play()
	currentTrack:GetPropertyChangedSignal("Playing"):Wait()
end