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

how can l Repeat this script?

 Workspace.PIDS.PIDS.Frame.TextLabel.Text = "A" 
 Wait(5)  
 Workspace.PIDS.PIDS.Frame.TextLabel.Text = "B" 
 Wait(5)  
 Workspace.PIDS.PIDS.Frame.TextLabel.Text = "C" 
 Wait(5)  
 Workspace.PIDS.PIDS.Frame.TextLabel.Text = "D" 
 Wait(5)

l want to after Display D and wait(5) and return to A(not stop the Display),how should l do?

2 answers

✓ Accepted answer
while true do
	workspace.PIDS.PIDS.Frame.TextLabel.Text = "A" 
	wait(5)  
	workspace.PIDS.PIDS.Frame.TextLabel.Text = "B" 
	wait(5)  
	workspace.PIDS.PIDS.Frame.TextLabel.Text = "C" 
	wait(5)  
	workspace.PIDS.PIDS.Frame.TextLabel.Text = "D" 
	wait(5)
end

1 comment

0

Good

Well, you could use the while true do end loop and repeat until nil loop. Try this;

repeat wait(0)until game:FindFirstChild("Workspace") and game.Workspace:FindFirstChild("PDIS")and game.Workspace.PDIS:FindFirstChild("PDIS")and game.Workspace.PDIS.PDIS:FindFirstChild("Frame")and game.Workspace.PDIS.PDIS.Frame:FindFirstChild("TextLabel") --I use this as a just-in-case

while game.Workspace:FindFirstChild("PDIS")do
game.Workspace.PIDS.PIDS.Frame.TextLabel.Text = "A"
wait(5) 
game.Workspace.PIDS.PIDS.Frame.TextLabel.Text = "B"
wait(5) 
game.Workspace.PIDS.PIDS.Frame.TextLabel.Text = "C"
wait(5) 
game.Workspace.PIDS.PIDS.Frame.TextLabel.Text = "D"
wait(5)
end

The repeat until nil loop is optional, I just use it as a just-in-case. Hope this helped!

7 comments

0

I dont see the point of having a JUST IN CASE with this script. What if the PDIS item got removed during the loop? It would crash. Facepalm.

0

The repeat until nil loop, within this script, will wait until it finds all those things, or until they finally exist, and I have to edit the while true do end loop a bit.

0

.. The script would still fail if the PIDS got removed while the wait(5)s.

0

There, edited the while true do end loop, while the PDIS exists within Workspace the script will keep working, but when it is removed, or parented into a different parent, the script will stop.

0

Yes, it would break, but as long as it isn't 'removed', the script will keep running. (Can't do stuff like Workspace:FindFirstChild("PDIS"):FindFirstChild("PDIS") because it won't work and will error. :l )

0

Good but l like less one

0

Oh my lord. -_-

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