Trying to make skybox change while inside an area

Hi, I am trying to make the skybox change while inside an area.
I found a script here, but it doesn’t seem to work for me. I’ve set it up how I think they meant, but the skybox does not change.
The script editor also says there is an error here.

image

The original post is here: How would I change the skybox in certain areas of my game? - #2 by Hanfian

Here is how I set it up:

Setup?

ReplicatedStorage has a RemoteEvent named BiomeTrigger and a “Skys” folder containing skyboxes.
image
In Workspace, invisible nocollide parts with matching names to skyboxes, scripts inside
image
In StarterGui, a LocalScript
image

Help with this would be very appreciated, thanks.

1 Like
          newSky.Parent = game.Lighting
     end
end

I’m unsure of this, but essentially all you’re doing is parenting the old skybox to ReplicatedStorage skybox storage, then parenting the new one to Lighting like you were. Print right after the skybox code to make sure it’s running that code!

It throws an error because the person who send the sample code forgot to set the “)” at the end of their code.

It should have looked like this:

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) -- here is where the ")" was missing

Let me know whether this works or not.

  • DosenSuppe2_0
1 Like