Greetings,
I am making a game about showing your local time by using a GUI that is above your head like in this screenshot.
But when I test it out in public servers, the time shows as 13:25 instead of 16:25 (in my time), I tried it out with a friend who lives in a different time zone and he has the same time as me. How can I fix this? (I might have explained it in a weird way but I hope you get the idea)
local function getCurrentTime()
local currentTime = os.time()
return os.date("%H:%M", currentTime)
end
local function updateTimeTextLabel(textLabel)
textLabel.Text = getCurrentTime()
end
local function updateOtherPlayerTimeTextLabel(textLabel, player)
local playerTime = player:GetAttribute("LocalTime")
textLabel.Text = playerTime
end
local timeLabel = script.Parent
updateTimeTextLabel(timeLabel)
while true do
wait(1)
updateTimeTextLabel(timeLabel)
end
game.Players.PlayerAdded:Connect(function(player)
local playerTimeLabel = script.Parent
player.AttributeChanged:Connect(function(attribute)
if attribute == "LocalTime" then
updateOtherPlayerTimeTextLabel(playerTimeLabel, player)
end
end)
updateOtherPlayerTimeTextLabel(playerTimeLabel, player)
end)