Changing text based on a certain time

Hello!

I am currently creating a GUI that shows a users profile and on that profile I want it to say something like “Good Monring, Username” or “Good Afternoon, Username” but I’m not really sure how i’d go about doing that.

I’ve got the username part covered I know how to display peoples usernames and avatar pics it’s just the time changing text.

Yes this will be based on a real timezone but what I tried doing originally was using my real time script that changes the time in Lighting and then trying to script it based on the TimeOfDay property under lighting.

Appreictate any help!

1 Like

I don’t think That is possible due to the conplications with scripts for it it could be possible but I’m not sure :face_with_raised_eyebrow:

Make the client send their os.time() value.

Here’s a doc on it: os | Roblox Creator Documentation

You could use os.time: os | Roblox Creator Documentation
Then you can check which hour it is. (Military time)

Read this article here.

Perhaps using os.date and os.time from the os library, you can find at what hour the client is at on their device:

local dateData = os.date("*t", os.time())
if dateData.hour >= 12 then
    -- afternoon for the client
else
    -- morning for the client
end

With a few customizations this worked perfectly thank you!