Real-Time light script

I found a script on the toolbox, but it obviously doesn’t work as this isn’t happening.

local CurrentSec
local CurrentMin
local CurrentHour
local CurrentTime
while true do
	wait(1)
	CurrentSec = os.date("!*t")["sec"]
	CurrentMin = os.date("!*t")["min"]
	CurrentHour = os.date("!*t")["hour"]
	CurrentTime = CurrentHour..":"..CurrentMin..":"..CurrentSec
	game.Lighting.TimeOfDay = tostring(CurrentTime)
end

How would I make a real-time light script that would actually set to the timezone of where the player is?

Try this:

local Lighting = game:GetService("Lighting")
Lighting.TimeOfDay = os.date("%X")
1 Like

Local script? Where should I put this exactly and what type of script? Thanks for responding!

That should be in a local script and I recommend putting it in StarterPlayer > StarterPlayerScripts

Also, if you want the time to update, you can use a loop:

local Lighting = game:GetService("Lighting")
local RunService = game:GetService("RunService")

RunService.RenderStepped:Connect(function()
	Lighting.TimeOfDay = os.date("%X")
end)
2 Likes

This is perfect! Thank you so much!

1 Like