Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to Change the Skybox at a Chosen Time Day?

For example, you have 2 custom Skyboxes. One of them activates from 06:00.00 to 15:00.00, then the second Skybox would overwrite the current Skybox from 15:00.00 to 6:00.00- Something like that. A How-To guide would be nice, thank you for your help.

1 answer

✓ Accepted answer
local time1 = 6
local time2 = 15
local skybox1 = game.ServerStorage:WaitForChild("Sky1")
local skybox2 = game.ServerStorage:WaitForChild("Sky2")
game.Lighting.LightingChanged:connect(function()
	local currenttime = game.Lighting:GetMinutesAfterMidnight()
	if currenttime >= time1*60 and currenttime < time2*60  then
		skybox1.Parent = game.Lighting
		skybox2.Parent = game.ServerStorage
	else
		skybox1.Parent = game.ServerStorage
		skybox2.Parent = game.Lighting
	end
end)

Note: This script assumes you have a time cycle already going on independently. Pretty self-explanatory but any questions?

1 comment

0

I should be settled, thank you for your help.

This discussion is preserved as it was. New answers, comments, and votes are closed.