Dialogue System Not Working As Intended

My dialogue system was working fine before and all of a sudden after testing my game today and NOT CHANGING ANYTHING it just didn’t work anymore. The issue is that it doesn’t wait for the player to click anymore and for some reason it repeats the same line for each line about 3-4 times.

Here’s the script:

local function TypeWrite(object, text)
	for i = 1, #text, 1 do
		object.Text = string.sub(text, 1, i)
		game.Workspace.Sound.SoundEffects.GUI.Tick:Play()
		wait(0.02)
	end
end

local Clicked = false

script.Parent.NextDialogueButton.MouseButton1Up:Connect(function()
	Clicked = true
end)


--Variables--


local Text = script.Parent.BlackBarBottom.Dialogue



--Dialogue Events--



game.ReplicatedStorage.NPCDialogueEvents.PeteDialogue.OnClientEvent:Connect(function()
	if game.Players.LocalPlayer.QuestNum.Value == 1 then
		script.Parent.BlackBarBottom.NPCName.Text = "Fisherman Pete"
		script.Parent.BlackBarBottom.NPCImage.Image = 11124482669
		Text.Text = ""
			
		wait(0.1)
			
		BeginDialogue()
		
		wait(1)
		
		TypeWrite(Text, "Hey, I'm Fisherman Pete. Nice to meet you!")
		
		wait(1)
		
		repeat wait() until Clicked == true
		Clicked = false
		
		TypeWrite(Text, "I'm kind of busy right now, we'll talk later.")
		
		wait(1)
		
		repeat wait() until Clicked == true
		Clicked = false
		
		EndDialogue()
		
		wait(1)
		
		game.ReplicatedStorage.NPCDialogueEvents.PeteDialogueFinished:FireServer()
elseif...