How is Roblox's Lighting.Clocktime caculated with the Lighting.TimeofDay?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I need help figuring out how roblox caculates the lighting.clocktime with the time of day incase i use that in the future for numbers

  2. What is the issue? Include screenshots / videos if possible! The issue is that i’m not sure how Lighting.Clocktime is caculated

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub? Yes i did

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

game.lighting.clocktime = 0.01 --> Lighting.Timeofday = ?

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

I’m not sure what use case this serves but here you go.

local function ClockToDay(Time)
	local Integral1, Decimal1 = math.modf(Time)
	local Integral2, Decimal2 = math.modf(Decimal1 * 60)
	return string.format("%02d:%02d:%02d", Integral1, Integral2, Decimal2 * 60)
end
print(ClockToDay(12.345)) --12:20:42

local function DayToClock(Time)
	local Hours, Minutes, Seconds = string.match(Time, "(%d+):(%d+):(%d+)")
	return tonumber(Hours + (Minutes / 60 + (Seconds / 3600)))
end
print(DayToClock("12:20:42")) --12.345
2 Likes