So, I'm making a script that gradually increases the time of day until the time hits 10:00:00. Here's the script:
local ToD = game.Lighting.TimeOfDay repeat wait(0.1) ToD:SetMinutesAfterMidnight(ToD:GetMinutesAfterMidnight() + 1) until ToD == "10:00:00"
The problem is that the output says GetMinutesAfterMidnight() is a nil value and the script breaks.
Output: 14:38:18.338 - Workspace.darkness:4: attempt to call method 'GetMinutesAfterMidnight' (a nil value)
I have no idea what's wrong with this script, but I bet some of you guys can help me with this.
GetMinutesAfterMidnight and SetMinutesAfterMidnight are both methods of Lighting, not TimeOfDay. It is also generally a bad idea to set a variable to a property, because the variable becomes what the property equals and is in no way connected to the property.
repeat wait(0.1) game.Lighting:SetMinutesAfterMidnight(game.Lighting:GetMinutesAfterMidnight() + 1) until game.Lighting.TimeOfDay == "10:00:00"