As you've noticed (by how many questions I've asked) I'm a beginner on my 4th(?) day of learning how to script. For my current project, I have scripted this using some help with functions from the wikia. Although I'm very proud of what a useful script I've made, it however bugs me about the length and structure of the code. Could I get some ideas about the script and how to make it better and more efficient? For example - Should I use if hour % 24 == 0 instead of if hour > 23? Thanks in advance!
hour = 0
day = 0
minutes = 0
while true do
wait(1)
minutes = minutes + 1
if minutes > 60 then
minutes = 0
hour = hour + 1
end
game.Lighting:SetMinutesAfterMidnight(hour*60)
if hour > 23 then
hour = 0
day = day + 1
end
print("It is day " .. tostring(day) .. tostring(" and ") .. tostring(minutes) .. tostring(" minutes past ") .. tostring(hour))
end

2 comments
Hi! I want to keep the seconds variable and, forgive me if I'm wrong, that replaces it?
To get the time, use game.Lighting.TimeOfDay