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.
local Status = game.StarterGui.StatusGUI.Status.Status.Text while wait(0) do Status = "Hygiene Time" wait(90) Status = "Fitness Time" wait(120) Status = "Breakfast Time" wait(90) Status = "Fitness Time" wait(120) Status = "Morning Roll-Call" wait(90) Status = "Cell Searches" wait(90) Status = "Fitness Time" wait(120) Status = "Lunch" wait(90) Status = "Fitness Time" wait(120) Status = "Supper" wait(90) Status = "Fitness Time" wait(120) Status = "Evening Roll-Call" wait(90) Status = "Sleep Time" wait(120) end
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.
local Status = game.StarterGui.StatusGUI.Status.Status while true do Status.Text = "Hygiene Time" wait(90) Status.Text = "Fitness Time" wait(120) Status.Text = "Breakfast Time" wait(90) Status.Text = "Fitness Time" wait(120) Status.Text = "Morning Roll-Call" wait(90) Status.Text = "Cell Searches" wait(90) Status.Text = "Fitness Time" wait(120) Status.Text = "Lunch" wait(90) Status.Text = "Fitness Time" wait(120) Status.Text = "Supper" wait(90) Status.Text = "Fitness Time" wait(120) Status.Text = "Evening Roll-Call" wait(90) Status.Text = "Sleep Time" wait(120) end