Dialogue Script Wait

How do i make it so the function waits till the other function is done with the text?

local CNT = game.ReplicatedStorage.CreateNewText
local DIO = game.ReplicatedStorage.DoorIsOpen

– Texts

local function Text_1() – Start
wait(1)
CNT:FireAllClients(“Dear god… My head… Where am i? What is this place?”) – John
wait(16)
CNT:FireAllClients(“Huh? A yellow door! Wonder how I could unlock it…”) – John
end

local function Text_2() – Door is opened.
CNT:FireAllClients(“Open sesame! There we go.”) – John
end

local function Text_3() – Mikhail contacts (calls) John as he made his way to the road.
CNT:FireAllClients(“Rise and shine, Jimmy… Welcome back!”) – Mikhail
end

local function Text_4()
CNT:FireAllClients(“Morning… Mike…”) – John
end

local function Text_5() – John opens the huge yellow door.
CNT:FireAllClients(“About time, John! I missed ya…”) – Bob
end

local function Text_6()
CNT:FireAllClients(“Looks like I won you at making the call with John, Bob…”) – Mikhail
end

local function Text_7()
CNT:FireAllClients(“Wasn’t a fair race!”) – Bob
end

local function Text_8()
CNT:FireAllClients(“Keep it down with the yapping, you two. John, it’s me, commander Gabriel.”) – Gabriel
end

local function Text_9()
CNT:FireAllClients(“What do i do now? I’m kind of lost…”) – John
end

local function Text_10()
CNT:FireAllClients(“Make your way to the industrial building next to the Clarke Tower, John.”) – Gabriel
end

local function Text_11()
CNT:FireAllClients(“Got it, Gabriel. Beowulf out.”) – John
end

local function Text_12() – John marches through the hotel, noticing the portal.
CNT:FireAllClients(“What’s… that?”) – John
end

local function Text_13() – John is nonchalant about the blood, making “Eugh” sounds wherever the user walks through it, John groans lightly when dashing to the road.
CNT:FireAllClients(“Must be some kind of portal forming. Don’t mind it, keep marching forward…”) – Mikhail
end

local function Text_14() --Bob is cut out as you enter deeper into the Clarke tower’s surrounding. You would encounter Knight ibarra, which would block the road. This was directly before making the turn that would lead to the road which leads to the objective; the industrial building.
CNT:FireAllClients(“Watchout, john, the conection in this place is limited… Make su-”) – Bob
end

local function Text_15()
CNT:FireAllClients(“Greetings, old timer. You can escape time, but you can’t escape me.”) – Ibarra
end

local function Text_16()
CNT:FireAllClients(“Why are you even here?”) – John
end

local function Text_17()
CNT:FireAllClients(“Oh, jack, you know, my mama told me to not play with food, but I wanted to make an exception…”) – Ibarra
end

local function Text_18()
CNT:FireAllClients(“You couldn’t kill me after all those years, and I reckon you couldn’t kill me now…”) – John
end

local function Text_19()
CNT:FireAllClients(“I’m not gonna kill you… And you can’t kill me, Jack, you don’t know where I am…”) – Ibarra
end

local function Text_20()
CNT:FireAllClients(“I wasn’t planning on it anyway…”) – John
end

local function Text_21()
CNT:FireAllClients(“Here you go, John, Follow your way into whatever life has set for you. But keep an eye open, i’ll find you…”) – Ibarra
end

local function Text_22()
CNT:FireAllClients(“Whatever…”) – John
end

local function Text_23() – The hijacking of the energy arch door would stop, as the transmission of Ibarra stopped. You’d continue into the industrial building. You would find Bob inside, which would be surrounded by dead cultists, besides dead civilians and miners, too.
CNT:FireAllClients(“Hello, John… Gabriel and Mikhail already set off to the Airport. You should follow them. I’m as good as ever here, so i’ll stay and use artillery to assist you.”) – Bob
end

local function Text_24()
CNT:FireAllClients(“Understood. Why do i need to go to the airport, anyway?”) – John
end

local function Text_25()
CNT:FireAllClients(“You need to help Mikhail, Gabriel and the Zealotry Task Force to evacuate the civilians out of the city through air.”) – Bob
end

local function Text_26()
CNT:FireAllClients(“Ah. Seems logical.”) – John
end

local function Text_27() – You’d march through the industrial building, exitting to a long road that led to the airport.
CNT:FireAllClients(“A cruiser is guarding the airport. Be sure to be quick, I don’t know how much it’s gonna hold up with all those iron birds flying around…”) – Bob
end
– Put the things in order

local function startGame() – This is your main function where we order the challenges
Text_1()
Text_2()
Text_3()
Text_4()
Text_5()
Text_6()
Text_7()
Text_8()
Text_9()
Text_10()
Text_11()
Text_12()
Text_13()
Text_14()
Text_15()
Text_16()
Text_17()
Text_18()
Text_19()
Text_20()
Text_21()
Text_22()
Text_23()
Text_24()
Text_25()
Text_26()
Text_27()
end

local function startText2()
Text_2()
end

DIO.OnServerEvent:Connect(startText2)

startGame()

Try putting a wait in between each function also make sure your waiting the time it takes to say the text

1 Like