How do I advance the time by exactly one minute?

Currently creating a system, the problem I have is the lighting. I need to make the time advance by one minute of in game time.

E.g. 06:30:00 → 06:31:00

The problem is I have no idea how.
I’ve tried increasing Lighitng.ClockTime, but no matter what I increase it by, it never is exactly one minute. I tried setting Lighting.TimeOfDay but its a string and there isnt exactly an easy solution I could find, nor a solution I could find at all.

So how do I increase the ingame time by exactly one minute?

And yes I did search, all I found is just making daycycles and what not

2 Likes

You could do something like this

local Lighting = game:GetService("Lighting")

local function add()
	local hours, minutes, seconds = Lighting.TimeOfDay:match("(%d+):(%d+):(%d+)")
	
	minutes = tonumber(minutes) + 1

	-- hh:mm:ss format (Roblox handles increments as they reach 60)
	Lighting.TimeOfDay = `{hours}:{minutes}:{seconds}`
end
3 Likes

easy:
game.Lighting.TimeOfDay = if if tonumber(game.Lighting.TimeOfDay:sub(4, 5)) + 1 >= 60 then "00" else tostring(tonumber(game.Lighting.TimeOfDay:sub(4, 5)) + 1) == "00" then if tonumber(game.Lighting.TimeOfDay:sub(1, 2)) + 1 >= 24 then ":00" else tonumber(game.Lighting.TimeOfDay:sub(1, 2)) + 1 .. ":" else game.Lighting.TimeOfDay:sub(1, 3) .. if tonumber(game.Lighting.TimeOfDay:sub(4, 5)) + 1 >= 60 then "00" else tostring(tonumber(game.Lighting.TimeOfDay:sub(4, 5)) + 1) .. game.Lighting.TimeOfDay:sub(6, 8)

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.