How to switch/disable from 1 sky to another

Hello,

So I’m making a horror game that will have 2 different skies in Lighting, mainly a Yellow sky combined with an Atmosphere to give it cool little Yellow fog effect. The thing is, once you go inside the game maze I want the Yellow one to disable and switch over to the other Black sky I have.

Normal appearance (Using the game thumbnail to show what it looks like with the yellow sky since I’m too lazy to go in studio for a new screenshot).

Appearance with a Black sky.

What Lighting looks like.
image

So my question is, can you actually disable a sky somehow? Using a script or something? How should I go about this? I hope this makes sense btw.

1 Like

I’m not sure if this will work, but you could store the unused skies in ServerStorage and switch them out with a script.

The thing is that I can’t really find any tutorials touching around my question as I mainly guide myself off of scripting tutorials since I don’t know how to myself. Is the any example on how the supposed code would look? At least something that I can try building off of.

1 Like

This is some pseudocode, you can figure out the exact formatting from here:

local Lighting = game:GetService("Lighting")
Lighting.AttributeChanged:Connect(function(a)
    if a == "Switch" then
        local att = Lighting:GetAttribute(a)
        local oldSky = Lighting:FindFirstChildOfClass("Sky")
        local newSky = game:GetService("ServerStorage"):FindFirstChild(att):Clone()
        newSky.Parent = Lighting
        oldSky:Destroy()
    end
end)
4 Likes