I have tried this so far and it works, but it stays on the same day of the week and does not change which is weird because there are no errors in the output.
local daysOfTheWeek = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" } for i=1, #daysOfTheWeek do for _, plr in pairs(game.Players:GetPlayers()) do local plrGui = plr:WaitForChild("PlayerGui") local serverWeekGui = plrGui:WaitForChild("ServerWeekGui") serverWeekGui.TextLabel.Text = daysOfTheWeek[i] end while not game.Lighting.ClockTime == 0 do wait(1) end end
What I want is for when the clock time changes to 0 for the day to change to the next day. Like say it's Monday, I want the day to change to Tuesday.
It's probably a syntax error, try putting parentheses with your not on line 17 like this
while not(game.Lighting.ClockTime == 0) do
I also suggest doing this if you want your script to work after day 7
local daysOfTheWeek = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" } for i=1, #daysOfTheWeek do for _, plr in pairs(game.Players:GetPlayers()) do local plrGui = plr:WaitForChild("PlayerGui") local serverWeekGui = plrGui:WaitForChild("ServerWeekGui") serverWeekGui.TextLabel.Text = daysOfTheWeek[i] end while not game.Lighting.ClockTime == 0 do wait(1) end if i == 7 then i = 0 end end
The problem you're encountering is that you're trying to Wait for the child of "ServerWeekGui". This GUI is a screen GUI, and would not work, because you cannot change the ScreenGui.
To resolve this, you'd simply have to index the hierarchy of the screen GUI, the (Textabel), and that would fix your error, this would index the text label, so it would actually run!
DAY/Night cycle script: (The below script works):
local daysOfTheWeek = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" } for z=1, #daysOfTheWeek do for _, plr in pairs(game.Players:GetPlayers()) do local plrGui = plr:WaitForChild("PlayerGui") local serverWeekGui = plrGui:WaitForChild("ScreenGui").TextLabel1 -- change "TextLabel1" to your textlabel name for i = 1, 23 do wait(5) -- change how fast the clocktime arises game.Lighting.ClockTime = i -- changes the clock time to the index if game.Lighting.ClockTime == i then serverWeekGui.Text = daysOfTheWeek[z] -- changes the text to the days of the week end end end end