Link to Day/Night cycle page used to take you to a page that just dealt with that subject, now it links to Task Scheduler.

Page URL: Learn Roblox | Sound, Lighting & FX
Impact: High
Frequency: Constantly
Date First Experienced: 2021-02-28 16:02:00 (-08:00)
Date Last Experienced:

Reproduction Steps:
When you go to the Atmosphere Controls page Learn Roblox | Sound, Lighting & FX or any page with the previous link to the Day/Night Cycles and streetlights button, it sends you to the Task Scheduler page:

https://developer.roblox.com/en-us/articles/task-scheduler

Expected Behavior:
I expected to get sent directly to the tutorial page that had the scripts and description of how to make a day/night cycle.
I used this link probably 2-3 weeks ago and was sent directly to the correct page.

Sending someone who is just learning the system and setup to the task scheduler page with absolutely no description of how to do day and night cycles would be very confusing.

Actual Behavior:
Any of the other buttons I found for this link all sent me to the task scheduler page as well.

Workaround:
Searched on Google and couldn’t find a link that sent me to the old page.

5 Likes

Hi there,
Apologies, but the page was temporarily taken down for a rework on better practices. Are you most interested in the day/night cycle part, the “street lights”, or both?

For just the day/night cycle part, consider this Script…

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

local MINUTES_AFTER_MIDNIGHT_START = 0
local CHANGE_RATE = 1  -- Experiment with lower values for more realistic day/night periods

local currentTime = MINUTES_AFTER_MIDNIGHT_START

local function setTime()
	currentTime = currentTime + CHANGE_RATE
	Lighting:SetMinutesAfterMidnight(currentTime)
end

RunService.Heartbeat:Connect(setTime)
3 Likes

It was a good source of information for both items.
I used it about a month ago for the street lights script, and was going to send someone in the forums who had a similar question there but couldn’t get the link.

1 Like

I would argue that this is not a best practice either. To my knowledge, the server would constantly spend resources updating clients with the new time every Heartbeat which is unnecessary and could take priority over potentially more important updates.

In my game, when clients join, they request a clock offset (and also request it again every so often in case it gets out of sync). The client can then use this offset with its own heartbeat connection to set the clock time as well as run all of its equations to set the color shifts, diffuse scale, and brightness. 0 cost pretty much.

Interesting… when do you request a re-sync check so that the cycle doesn’t appear to “skip” if things are out-of-sync? I suppose the deep night hours would be best in terms of lighting (which shouldn’t change for several hours), but if there are celestial bodies enabled, even the cycling moon could skip on a re-sync. Or perhaps I’m just overthinking this… :slight_smile:

2 Likes

I’ve never noticed the resync visually while playing my game, and none of my players have reported it either. I guess it’s more of a “just-in-case” than anything else, because specific time matters to my game—the clock is on everyone’s screen and it dictates when shops open and close, etc.