I'm trying to make it so the text on a GUI will change when it is a certain time of day in roblox. I have it set up so there is a StringValue in ReplicatedStorage named "StatusValue". Then I have a text label in a gui on Roblox named "TaskName" there is a script in TaskName that makes it so the Text reads whatever the value of StatusValue is. Finally there is a script in ServerScriptService which i have set to change the Value of StatusValue during certain times of day. But for some reason when i test it out the StatusValue does not change and so forth my GUI does not function as intended. Here is the ServerScriptService script I am using. I can't figure out whats wrong with it. Help will be much appreciated. Thank you!
local replicatedstorage = game:GetService("ReplicatedStorage") local status = replicatedstorage:WaitForChild("StatusValue") local l = game.Lighting:GetMinutesAfterMidnight() if l<6 or l>6.5 then status.Value = "Wake Up Call" end if l<6.5 or l>7 then status.Value = "Breakfast" end if l<7 or l>12 then status.Value = "Free Time" end if l<12 or l>19.5 then status.Value = "Hard Labor" end if l<19.5 or l>20 then status.Value = "Dinner" end if l<20 or l>23 then status.Value = "Free Time" end if l<23 or l>6 then status.Value = "Lights Out" end
Here is the LocalScript that is supposed to change the TextLabel to the value of the StatusValue
local replicatedstorage = game:GetService("ReplicatedStorage") local status = replicatedstorage:WaitForChild("StatusValue") script.Parent.Text = status.Value status.Changed:connect(function() script.Parent.Text = status.Value end)
Since l = the minutes after midnight, what you are checking for in the script is if its 6 minutes after midnight, not 6 hours, all you need to do is add a *60 to all of them
local replicatedstorage = game:GetService("ReplicatedStorage") local status = replicatedstorage:WaitForChild("StatusValue") local l = game.Lighting:GetMinutesAfterMidnight() if l<6*60 or l>6.5*60 then status.Value = "Wake Up Call" end if l<6.5*60 or l>7*60 then status.Value = "Breakfast" end if l<7*60 or l>12*60 then status.Value = "Free Time" end if l<12*60 or l>19.5*60 then status.Value = "Hard Labor" end if l<19.5*60 or l>20*60 then status.Value = "Dinner" end if l<20*60 or l>23*60 then status.Value = "Free Time" end if l<23*60 or l>6*60 then status.Value = "Lights Out" end