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

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

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

1 answer

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

2 comments

0

It works! Thank you!

0

No problem!

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