How can I make game clock time on a TextLabel?

I know that studio has built in game hours, minutes and seconds. However, I want to put this game time on a TextLabel so it can change every hour or so. Like for example, its 9:13:27 AM in game and its bright out, it is 8:49:32 PM inside the game and it is dark.

Does anyone know how I can do this? This plays a really significant role in my game.

2 Likes

You would have to use the TimeOfDay Property to change the time

For it to affect the server, you would have to create a string value inside of workspace and name it whatever, then create a script and put this in it:

while true do

wait(1)
	game.Workspace.TimeOfDay.Value = "0:00 AM"
	wait(1)
	game.Workspace.TimeOfDay.Value = "1:00:00"
	wait(1)
	game.Workspace.TimeOfDay.Value = "2:00:00"
	
end

and continue the script. Then create a local script in startergui and do this:

while true do
wait(0.4)
if game.Workspace.TimeOfDay.Value == "1:00:00" then
	game.Lighting.TimeOfDay = "1:00:00"
	script.Parent.MainGui.TextLabel.Text = "1:00:00 AM"
else
	if game.Workspace.TimeOfDay.Value == "2:00:00" then
		game.Lighting.TimeOfDay = "2:00:00"
		script.Parent.MainGui.TextLabel.Text = "2:00:00 AM"
	end
end

end

And create some stuff inside of startergui according to the local script
Try to continue these two scripts.