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

how can l Repeat this script?

Asked by 10 years ago
 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

Log in to vote
-1
Answered by
hudzell 238 Moderation Voter
10 years ago
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
0
Good 7785543 2 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

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!

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. Nickoakz 231 — 10y
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. TheeDeathCaster 2368 — 10y
0
.. The script would still fail if the PIDS got removed while the wait(5)s. Nickoakz 231 — 10y
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. TheeDeathCaster 2368 — 10y
View all comments (3 more)
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 ) TheeDeathCaster 2368 — 10y
0
Good but l like less one 7785543 2 — 10y
0
Oh my lord. -_- TheeDeathCaster 2368 — 10y

Answer this question