I have written a script that tells the IRL time and it is not working, here is the script:
local mainFrame = script.Parent:WaitForChild("MainFrame")
local timeLabel = mainFrame:WaitForChild("Time")
while wait() do
local seconds = os.date("*t")["sec"]
local minutes = os.date("*t")["min"]
local hours = os.date("*t")["hours"]
if tonumber(seconds) <= 9 then
seconds = "0"..seconds
end
if tonumber(minutes) <= 9 then
minutes = "0"..minutes
end
if tonumber(hours) <= 9 then
hours = "0"..hours
end
timeLabel.Text = hours..":"..minutes..":"..seconds
end
Here is the error:
Players.potatocure.PlayerGui.TimeGui.LocalScript:17: attempt to compare nil <= number - Client - LocalScript:17
You can not change the timezone, you would just need to add the time difference to the table. to do this, you just need something like this:
local mainFrame = script.Parent:WaitForChild("MainFrame")
local timeLabel = mainFrame:WaitForChild("Time")
while wait() do
local cesttime = os.time() + 7200
local seconds = os.date("*t", cesttime)["sec"]
local minutes = os.date("*t", cesttime )["min"]
local hours = os.date("*t", cesttime )["hours"]
if tonumber(seconds) <= 9 then
seconds = "0"..seconds
end
if tonumber(minutes) <= 9 then
minutes = "0"..minutes
end
if tonumber(hours) <= 9 then
hours = "0"..hours
end
timeLabel.Text = hours..":"..minutes..":"..seconds
end