Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Stop dialogue when it ends?

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

3 comments

0

Can you give more explanations?

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

0

Already got answered, thank you anyways!

1 answer

✓ Accepted answer

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.

1 comment

0

Thank you!

This discussion is preserved as it was. New answers, comments, and votes are closed.