Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Stop dialogue when it ends?

Asked by 4 years ago
Edited 4 years ago

So i made a story game where the npc talks, but when it reachs the end of the dialogue, it goes all again

Dialogue script:

while true do
    script.Parent.Text = "Hello and welcome to the game, my name is Thomas and I will be your guide"
    wait (10)
    script.Parent.Text = "Today we will be exploring that cave behind me, maybe we can find something great!"
    wait (10)
    script.Parent.Text = "Well, do you see these cabins behind me? These will be your home in this trip"
    wait (10)
    script.Parent.Text = "Ok, now that we are ready, let's go!"
    wait(1)

end
0
Can you give more explanations? NiniBlackJackQc 1562 — 4y
0
It keeps repeating all over again because it's inside a while true loop which goes on forever, so just take it out of that loop if you don't want it repeating Nanomatics 1160 — 4y
0
Already got answered, thank you anyways! Shadic1270 136 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

You aren't using break so the code will always repeat.

while true do
    script.Parent.Text = "Hello and welcome to cave trip, my name is Thomas and I will be your guide"
    wait (10)
    script.Parent.Text = "Today we will be exploring that cave behind me, maybe we can find something great!"
    wait (10)
    script.Parent.Text = "Well, do you see these cabins behind me? These will be your home in this trip"
    wait (10)
    script.Parent.Text = "Ok, now that we are ready, let's go!"
    wait(1)
    break
end

This will stop the loop after it goes through the loop once, because of the break.

0
Thank you! Shadic1270 136 — 4y
Ad

Answer this question