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.
✓ ANSWER ACCEPTED
What script do I use to create a skybox for the planet?
2 answers
✓ Accepted answer
From what I understand in your post, you could do the following;
- Create a dictionary of all the skyboxes
local Skyboxes = {
Earth = {
SkyboxBk = -- Id here
-- Insert other Earth skybox IDs
}
}
- 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
- 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.
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.

13 comments
Have to put everything inside the module script?
That's your choice
Does not work
I hope you filled in anything you needed instead of just directly copying
I filled it all in but I went to test nothing happened
If you put it in a module script, you need to call your function in another script
you can send a more explained example I don't know what I do :/
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
That means your skybox doesn't exist, you need to create one
guy can't pass a better example I didn't understand it very well.
What better example is there to give other than "Create a skybox"
forget it, i said. Well, it didn't work, I did everything, but there is that error that I already showed you.
zboi knows that I wanted to say, in relation to creating skybox for planet, I also meant creating skybox in different areas