Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to Change the Skybox at a Chosen Time Day?

Asked by
iBuizel 15
8 years ago

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

Log in to vote
0
Answered by 8 years ago
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?

0
I should be settled, thank you for your help. iBuizel 15 — 8y
Ad

Answer this question