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

My prison status GUI refuses to change. Why won't this loop work?

Asked by 4 years ago

I have a prison game, where there is a GUI at the top that shows the current status of the prison. I made a loop to have it change after a specific amount of time, but the text does not change at all. Any idea why? This script is in ServerScriptService.

01local Status = game.StarterGui.StatusGUI.Status.Status.Text
02 
03while wait(0) do
04    Status = "Hygiene Time"
05    wait(90)
06    Status = "Fitness Time"
07    wait(120)
08    Status = "Breakfast Time"
09    wait(90)
10    Status = "Fitness Time"
11    wait(120)
12    Status = "Morning Roll-Call"
13    wait(90)
14    Status = "Cell Searches"
15    wait(90)
View all 30 lines...

1 answer

Log in to vote
0
Answered by
LazokkYT 117
4 years ago
Edited 4 years ago

while wait(0) do is not the correct way to do a while loop. Also, if you reference properties in the variable, it will think it is a child of the gui object.

01local Status = game.StarterGui.StatusGUI.Status.Status
02 
03while true do
04    Status.Text = "Hygiene Time"
05    wait(90)
06    Status.Text = "Fitness Time"
07    wait(120)
08    Status.Text = "Breakfast Time"
09    wait(90)
10    Status.Text = "Fitness Time"
11    wait(120)
12    Status.Text = "Morning Roll-Call"
13    wait(90)
14    Status.Text = "Cell Searches"
15    wait(90)
View all 30 lines...
0
It works! Thank you! MrOinkerzYT 87 — 4y
0
No problem! LazokkYT 117 — 4y
Ad

Answer this question