Change Skybox (Normal To Red) upon Bindable Event

Problem: SkyBox not changing.
What it’s supposed to do: Change the skybox after yielding for 30 seconds.

Code:

local sky = Instance.new("Sky") 
local Lighting = script.Parent 
local upon_being_broken = game.ReplicatedStorage.Upon_Being_Broken 

upon_being_broken.Event:Connect(function() 
    wait(20)
    sky.Parent = Lighting
    sky.SkyboxBk = "http://www.roblox.com/asset/?version=1&id=1012890" 
    sky.SkyboxDn = "http://www.roblox.com/asset/?version=1&id=1012891" 
    sky.SkyboxFt = "http://www.roblox.com/asset/?version=1&id=1012887" 
    sky.SkyboxLf = "http://www.roblox.com/asset/?version=1&id=1012889" 
    sky.SkyboxRt = "http://www.roblox.com/asset/?version=1&id=1012888" 
    sky.SkyboxUp = "http://www.roblox.com/asset/?version=1&id=1014449" 
end)
3 Likes

skyboxes use rbxassetid://
i think
image

2 Likes

I don’t think that worked, sky’s blue. There’s more than one ‘Sky’ Asset but I’m not sure if that’s a problem I should be concerned about.

2 Likes

if the names are the same, then yeah

2 Likes

wait no, i just saw that you made a new instance*

1 Like
local sky = Instance.new("Sky") 
local Lighting = script.Parent 
local upon_being_broken = game.ReplicatedStorage.Upon_Being_Broken 

upon_being_broken.Event:Connect(function() 
    wait(20)
    sky.Parent = Lighting
    sky.SkyboxBk = "rbxassetid://1012890" 
    sky.SkyboxDn = "rbxassetid://1012891" 
    sky.SkyboxFt = "rbxassetid://1012887" 
    sky.SkyboxLf = "rbxassetid://1012889" 
    sky.SkyboxRt = "rbxassetid://1012888" 
    sky.SkyboxUp = "rbxassetid://1014449" 
end)
1 Like

i dont think scripts run in the Lighting

1 Like

shoot, your probs right

i didn’t read the script fully

1 Like

So dont put it in lighting, hm so workspace?

1 Like

This didnt work either im afraid to say.

1 Like

does anyone else know of a possible solution? cant find anyone else doing this

I guess you can probably put the skybox in place like ServerStorage in Studio, then use the script to clone it to Lighting when you need the sky to change.

1 Like

the sky box is created and given attributes within the script, but ill clone it like you said

1 Like

There could be two ways to do this:

1-Make a default “normal” skybox and a red skybox, then switch their parents on the script (without calling “instance.new”) for example, “normalsky.Parent = game.ServerStorage”, “redsky.Parent = game.Lighting”

2-With a “normal” sky already in lighting, simply type “local sky = game.lighting.sky” and don’t parent it, because if you have more than one skybox instance, some weird things could happen.

Also, make sure the script is somewhere else depending on its type (if its a server script, put in in serverscriptservice and if its a local one, put it on player scripts or playergui or something) and also depending on the type it could be .Event or .Onserverevent or something else

Could you maybe show us what shows up in your output window please??

1 Like

Hey, me again. Sorry to all for the confusion as I’ve already found my solution. It was wickddd’s but with the “rbxassetid://” changed to whatever asset is given to you, if that makes any sense. I’d be happy to help anyone with this same problem.

2 Likes

Not only that, but the script should not be in lighting, put it in workspace.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.