Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I write a script that says Good Morning/Afternoon/Evening according to the real BST time?

Asked by 5 years ago

I need some help for a GUI. I want to have a text label at the front page that basically says "Good Morning'' in the morning and "Good evening" in the evening. I'd like the script to do this according to the real BST time. Could anyone explain me how to do this (or just give me a source that I can copy lmao)? Your help is appreciated.

1 answer

Log in to vote
0
Answered by
royaltoe 5144 Moderation Voter Community Moderator
5 years ago

You can get the time in GMT and then add one hour to compensate for time differences:

gmtTime = os.date("!*t") --returns a dictonary contaning time in GMT
gmtHour = gmtTime.hour --gets gmt's hour 
bstHour = gmtHour + 1 --bst is one hour ahead of gmt so we account for that

greetingText = ""
if(bstHour < 12)then
    greetingText = "Good Morning"
else
    greetingText = "Good Afternoon"
end

print(greetingText)
0
i thought roblox didnt have os.date and os.clock EmbeddedHorror 299 — 5y
0
they do, test it out yourself in studio royaltoe 5144 — 5y
Ad

Answer this question