That would work perfectly if MainGui was a valid member.
By the way, probably hasn't initialized MainGui yet,
wait until the player has completely initialized before trying to redefine variables.
Also, if there is an intermission, it would be more easily controlled like this:
inttime = 30
timeDef = 60
time = 0
int = Instance.new("BoolValue",game.Workspace)
int.Name = "Intermission"
int.Value = false
function timer()
time = timeDef
repeat time = (time - 1) wait(1) until time <= 0
int.Value = true
end
function intermission()
time = inttime
repeat time = (time - 1) wait(1) until time <= 0
int.Value = false
end
timer()
int.Changed:connect(function()
if int.Value == true then
intermission()
else timer()
end
end)
timer()
and in a local script inside the GUI's text
repeat wait() until game.Workspace:FindFirstChild("Intermission")
while wait(1/15) do
if game.Workspace.Intermission.Value == true then
script.Parent.Text = "Intermission"
else script.Parent.Text = "Not Intermission"
end
end
Hope this helped!
1 comment
I think you need to put an :WaitForChild --> player.PlayerGui:WaitForChild("MainGui") if the code don't run its because MainGui is nil