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

My script keeps repeating itself when im in the game?

I wrote a script for my camping game, i wrote the text talking and i was done with the script. It was fine until it started repeating everytime and i didn't know how to make it stop.

while true do script.Parent.Text = "Hello and welcome to The Forest!" wait(5) script.Parent.Text = "We are gonna have the most amazing night ever here! Right guys?" wait(5) script.Parent.Text = "Anyways, lets start our big journey!" end

2 comments

1

Remove while true do end, you basically have this in an infinite loop.

0

You placed a while loop, obviously it's gonna repeat itself. So just remove it.

2 answers

It repeats because you have your code within an infinite loop (while true do), to make it not repeat just remove the loop

script.Parent.Text = "Hello and welcome to The Forest!" 
wait(5) 
script.Parent.Text = "We are gonna have the most amazing night ever here! Right guys?" wait(5) 
script.Parent.Text = "Anyways, lets start our big journey!"

1 comment

0

you could even add a once a player joins to make it do everytime a player joins

Such a simple question to answer, simply remove the 'while true do' while true do makes the script below it repeat itself over and over and over... Unless you place a 'break'

while true do
script.Parent.Text = "Hello and welcome to The Forest!" 
wait(5) 
script.Parent.Text = "We are gonna have the most amazing night ever here! Right guys?" 
wait(5) 
script.Parent.Text = "Anyways, lets start our big journey!
break
end

the break will end the loop:

break

But a easy solution to make it only play once is to just put your code usually:

script.Parent.Text = "Hello and welcome to The Forest!" 
wait(5) 
script.Parent.Text = "We are gonna have the most amazing night ever here! Right guys?" wait(5) 
script.Parent.Text = "Anyways, lets start our big journey!

you could also put a if player joins script to make it happen every time, but i wont put that here.

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