How would I change the skybox in certain areas of my game?

Hi! I’m designing a large, open world game with many different biomes/regions. I was wondering if it would be possible to have my skybox change for a player depending on their location. Is this possible? If so, how would I achieve this?

2 Likes

Put the possible skyboxes in a folder in ReplicatedStorage. Name the folder “Skys”
Put a RemoteEvent in ReplicatedStorage. Name it BiomeTrigger

On the client, create a LocalScript

game.ReplicatedStorage.Remote.BiomeTrigger.OnClientEvent:Connect(function(SkyName)
    local Sky = game.ReplicatedStorage:FindFirstChild(SkyName)
    if  Sky then
        local newSky = Sky:Clone()
        local newSky.Name = "Sky"
        local oldSky = game.Lighting:FindFirstChild("Sky")
        if oldSky then
            oldSky:Destroy()
        end
        newSky.Parent = game.Lighting
    end
            
    end

You can create an invisible part that fires the client when its touched. You could put those at the entrances of your different areas. Name the part the name of the sky

script.Parent.Touched:Connect(function(playerPart)
    local Player = game.Players:FindFirstChild(playerPart.Parent.Name)
    if Player then
        game.ReplicatedStorage.BiomeTrigger:FireClient(Player,script.Parent.Name)
    end
end)
11 Likes

What if I was trying to change the atmosphere in the same manner? When I try to replace the “sky” it doesnt work.

3 Likes

I didn’t notice this “client, create a LocalScript” part ;-;

1 Like