Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What script do I use to create a skybox for the planet?

With what script does to create a skybox for the planet, I made a space game I wanted to make it realistic by putting this, example: When entering the planet to change background skybox.

2 answers

✓ Accepted answer

From what I understand in your post, you could do the following;

  1. Create a dictionary of all the skyboxes
local Skyboxes = {
	Earth = {
		SkyboxBk = -- Id here
		-- Insert other Earth skybox IDs
	}
}
  1. When the player chooses a planet, grab the values
local Input = script.Parent.Text -- This is an example for getting the planet

if Skyboxes[Input] then
	
end
  1. Put all of the Id's into their respective properties
game.Lighting.Skybox.SkyboxBk = Skyboxes[Input]["SkyboxBk"]

And do Step 3 for every Skybox slot.

Hope this gives you a pointer in the right direction.

13 comments

0

Have to put everything inside the module script?

0

That's your choice

0

Does not work

0

I hope you filled in anything you needed instead of just directly copying

0

I filled it all in but I went to test nothing happened

0

If you put it in a module script, you need to call your function in another script

0

you can send a more explained example I don't know what I do :/

0

Hello man again I did everything right but there was an error here says: 14:25:08.474 - Workspace.Planets.Mars.Script:42: attempt to index nil with 'SkyboxBk' 14:25:08.475 - Stack Begin 14:25:08.476 - Script 'Workspace.Planets.Mars.Script', Line 42 14:25:08.477 - Stack End

0

That means your skybox doesn't exist, you need to create one

0

guy can't pass a better example I didn't understand it very well.

0

What better example is there to give other than "Create a skybox"

0

forget it, i said. Well, it didn't work, I did everything, but there is that error that I already showed you.

0

zboi knows that I wanted to say, in relation to creating skybox for planet, I also meant creating skybox in different areas

zboi_082007 did I do it right or wrong the script?

I did it that way

local Skyboxes = {
    Eve = {
        SkyboxBk = "rbxassetid://1012890", -- Id here
        SkyboxDn = "rbxassetid://1012891",
        SkyboxFt = "rbxassetid://1012887",
        SkyboxLf = "rbxassetid://1012889",
        SkyboxRt = "rbxassetid://1012888",
        SkyboxUp = "rbxassetid://1014449",
        -- Insert other Earth skybox IDs
    }
}
local Input = script.Parent.Parent.Eve -- This is an example for getting the planet

if Skyboxes[Input] then

end
game.Lighting.Skybox.SkyboxBk = Skyboxes[Input]["SkyboxBk"]
game.Lighting.Skybox.SkyboxDn = Skyboxes[Input]["SkyboxDn"]
game.Lighting.Skybox.SkyboxFt = Skyboxes[Input]["SkyboxFt"]
game.Lighting.Skybox.SkyboxLf = Skyboxes[Input]["SkyboxLf"]
game.Lighting.Skybox.SkyboxRt = Skyboxes[Input]["SkyboxRt"]
game.Lighting.Skybox.SkyboxUp = Skyboxes[Input]["SkyboxUp"]

This discussion is preserved as it was. New answers, comments, and votes are closed.