Hey! I am currently doing something where it will say the local players time if they are in that time zone, so they do not need to convert their time zone to MST themselves, so I can get as many people as possible into my live event.
I don’t want to sit here for an hour and figure this out.
Is there any way to accomplish this 9999999999x easier?
local TimeZone = os.date("%Z")
if TimeZone == "MDT" then
script.Parent.Text = "Until the Live Event - August 14 at 1:00 PM MST"
elseif TimeZone == "EDT" then
script.Parent.Text = "Until the Live Event - August 14 at 3:00 PM EDT"
elseif TimeZone == "CDT" then
script.Parent.Text = "Until the Live Event - August 14 at 2:00 PM CDT"
elseif TimeZone == "PDT" then
script.Parent.Text = "Until the Live Event - August 14 at 12:00 PM PST"
elseif TimeZone == "UTC" then
script.Parent.Text = "Until the Live Event - August 14 at 7:00 PM UTC"
end
Yes, there are a few ways, however the best way would probably be to store everything in its own table, and loop through the times and determine which one they are in.
local Timezones = {
['MDT'] = 'Until the Live Event - August 14 at 1:00 PM MST',
['EDT'] = 'Until the Live Event - August 14 at 3:00 PM EDT',
['CDT'] = 'Until the Live Event - August 14 at 2:00 PM CDT',
['PDT'] = 'Until the Live Event - August 14 at 12:00 PM PST',
['UTC'] = 'Until the Live Event - August 14 at 7:00 PM UTC'
}
local TimeZone = os.date('%Z')
for Time, Text in pairs(Timezones) do
if TimeZone == Time then
script.Parent.Text = Text
end
end