Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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)

2 comments

0

i thought roblox didnt have os.date and os.clock

0

they do, test it out yourself in studio

This discussion is preserved as it was. New answers, comments, and votes are closed.