So I am making a game and I have made a working day/night cycle. The cycle works in online mode as well as test mode, but I also wanted to turn global shadows off at night.I accomplished this and it works in test mode, but in play mode, it does not work. Here is my script:

minutesAfterMidnight = 840
while true do
	minutesAfterMidnight = minutesAfterMidnight + .05
	game.Lighting:SetMinutesAfterMidnight(minutesAfterMidnight)
	wait(.05)
	if game.Lighting:GetMinutesAfterMidnight() == 3.3 * 60 then		
		game.Lighting.GlobalShadows = true
	end
	if game.Lighting:GetMinutesAfterMidnight() == 20.80 * 60 then		
		game.Lighting.GlobalShadows = false
	end
end

This is inside a regular script, which is in the Workspace.

1 comment

0

Try putting the script in the ServerScriptService folder.