I have been trying to code a time message, no errors so I do not know what I am doing wrong.
if os.date("%X") >= "06:00:00" then
script.Parent.screens.home.profile.message.Text = "Morning, "..game.Players.LocalPlayer.Name..'!'
end
I have been trying to code a time message, no errors so I do not know what I am doing wrong.
if os.date("%X") >= "06:00:00" then
script.Parent.screens.home.profile.message.Text = "Morning, "..game.Players.LocalPlayer.Name..'!'
end
if DateTime.now():ToLocalTime().Hour >= 6 then
script.Parent.screens.home.profile.message.Text = "Morning, "..game.Players.LocalPlayer.Name..'!'
end
It appears you are comparing two strings in a numerical sense. I would do something like this instead with your idea:
local Time = os.date("%X"):split(":") -- Splits the string into three strings.
-- Time[1] = Hours
-- Time[2] = Minutes
-- Time[3] = Seconds
if tonumber(Time[1]) >= 6 then
script.Parent.screens.home.profile.message.Text = "Morning, "..game.Players.LocalPlayer.Name..'!'
end
Yours did not work, not error. I have no idea why.
Are you constantly looping the code, or did you run it once?