Mission system bugs when trying the mission for the second time

Hello, its my first time trying to create a script without any tutorials, and i think im going well except for a little problem, im creating a mission system and i implemented a thing that when you die, it fails the mission, and i implemented a timer for you to do the mission, which you can set the minutes and seconds, and after the countdown ends, it fails the mission too, a problem i am having is that when you die after the timer started and try again the mission, it fails instantly because of the timer, i think, and im not sure how i would go about fixing it.

Well thats all to explainm, if you need further explanation i can provide everything

client

progressEvent.OnClientEvent:Connect(function(startClone, bagClone, objectiveClone, timer, seconds, minutes, failedDescription, missionType)
			missionFunctions.Hide(bagClone)
			missionFunctions.Show(objectiveClone)
			
			missionFunctions.DialogueControl(dialogue, [[Deliver the bag to <font color="rgb(255,255,0)">Lil Pip</font>.]])
			
			if timer then
				local timerGuiClone = timerGui:Clone()
				timerGuiClone.Parent = playerGui

				missionFunctions.SetTimer(timerGuiClone, seconds, minutes)
				
				missionFunctions.HideGui(dialogue)
				
				missionFunctions.Hide(bagClone)
				missionFunctions.Hide(objectiveClone)

				missionFunctions.failedGui(failedGui, failedDescription, missionType)

				missionFunctions.Show(startClone)
			end
		end)
failedEvent.OnClientEvent:Connect(function(timer, startClone, bagClone, objectiveClone, failedDescription, missionType)
			missionFunctions.HideGui(dialogue)
			
			if timer then
				missionFunctions.HideGui(playerGui:FindFirstChild("Timer"))
			end
			
			missionFunctions.Hide(bagClone)
			missionFunctions.Hide(objectiveClone)
			
			missionFunctions.failedGui(failedGui, failedDescription, missionType)
			
			missionFunctions.Show(startClone)
		end)

server

startClone.Touched:Connect(function(hit)
			local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
			
			if player and not debounce1 then
				local character = hit.Parent
				local humanoid = character:WaitForChild("Humanoid")
				
				local missionEnabled = character:WaitForChild("Missions")[missionFolder.Name].Enabled
				local missionRunning = character:WaitForChild("Missions")[missionFolder.Name].Running
				local missionCompleted = character:WaitForChild("Missions")[missionFolder.Name].Completed
				
				humanoid.Died:Connect(function()
					if missionRunning.Value == true then
						missionEnabled.Value = true
						missionRunning.Value = false
						
						failedEvent:FireClient(player, timer, startClone, bagClone, objectiveClone, failedDescription, missionType)
					end
				end)
if missionRunning.Value == true then
					progressEvent:FireClient(player, startClone, bagClone, objectiveClone, timer, countdownSeconds, countdownMinutes, failedDescription, missionType)
					
					if timer then
						if countdownMinutes > 0 then
							waitTime = 60 * 2 + countdownSeconds
						else
							waitTime = countdownSeconds
						end
						
						if waitTime ~= nil then
							wait(waitTime)
						end
						
						missionEnabled.Value = true
						missionRunning.Value = false
					end
				end

VIDEO