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

How to make a GUI which when clicked changes the LocalPlayers skybox?

So in my difficulty chart obby there's a stage coloured black so it would be impossible to play with a black skybox but some stages can't be played with a white skybox so I was wondering if there was a script I put in a GUI which when pressed changes the skybox from a white one to a black one.

1 comment

0

This is not a request site. And your request is not that hard to make.

1 answer

✓ Accepted answer

You could use this script. Make sure to put the Skyboxes in Workspace and name them "Black" and "White". This script will toggle. Also make sure, you put this lines in a LocalScript.

Inser a ScreenGui, put a local script in it and paste the following code. Insert a button in the ScreenGui and playtest. Plus this is local, dw.

local currentSky = "White"

local wsc = game.Workspace:FindFirstChild("White"):Clone()
wsc.Parent = game.Lighting

script.Parent.TextButton.MouseButton1Click:Connect(function()
	if currentSky == "White" then
		currentSky = "Black"
		game.Lighting:FindFirstChild("White"):Destroy()
		local bsc = game.Workspace.Black:Clone()
		bsc.Parent = game.Lighting
	else
		currentSky = "White"
		game.Lighting:FindFirstChild("Black"):Destroy()
		local wsc = game.Workspace.White:Clone()
		wsc.Parent = game.Lighting
	end
end)

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