Original Script BTW https://scriptinghelpers.org/questions/133002/script-doesnt-change-getchildren-parents

(read the above script because it has the same / similar problems) anyways it was working before but then it just stopped working, I wonder if I added something that broke the script. can anyone help?

Script

local Lighting = game:GetService("Lighting")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local lobby = ReplicatedStorage.Lobby:GetChildren()
local abandonedoffice = ReplicatedStorage.AbandonedOffice:GetChildren()
local LightingChildren = Lighting:GetChildren()
local curlev = workspace["Current Level"]
local change = ReplicatedStorage.ChangeLevels

local function setParent(children, parent)
	for _, child in ipairs(children) do
		child.Parent = parent
	end
end

while task.wait() do
	if curlev.Value == "Level0" then
		setParent(LightingChildren, nil)
		setParent(lobby, Lighting)
		Lighting.Brightness = 0
		Lighting.Ambient = Color3.fromRGB(0,0,0)
		Lighting.OutdoorAmbient = Color3.fromRGB(0,0,0)
		Lighting.EnvironmentDiffuseScale = 0
		Lighting.EnvironmentSpecularScale = 0
		Lighting.ColorShift_Top = Color3.fromRGB(0,0,0)
		Lighting.ColorShift_Bottom = Color3.fromRGB(0,0,0)
	end
	if curlev.Value == "Level4" then
		setParent(LightingChildren, lobby)
		setParent(abandonedoffice, Lighting)
		Lighting.Brightness = 1
		Lighting.Ambient = Color3.fromRGB(22,22,22)
		Lighting.OutdoorAmbient = Color3.fromRGB(0,0,0)
		Lighting.EnvironmentDiffuseScale = 0
		Lighting.EnvironmentSpecularScale = 0
		Lighting.ColorShift_Top = Color3.fromRGB(0,0,0)
		Lighting.ColorShift_Bottom = Color3.fromRGB(0,0,0)
	end
end

3 comments

0

Luau has debugging features. Use them. In studio you can open the console through the View menu. No one here has any idea what your actual problem is.

0

sadge

0

Could you tell what's your problem? From what I see, you forgot to reparent the lobby to workspace and put abandoned office in Lighting in Level0, and the same thing as Level4.