This is based on my old post, this time I made the code a bit simpler (not really) and tried to explain the problems more clearly, sorry for the inconvenience
I'm making a script so that whenever the value changes, it will get the current lighting children and move them back into a folder in ReplicatedStorage (or for the first time, sets the parent to nil) and gets the children from another folder in ReplicatedStorage and sets their parents to lighting, while also changing some of the settings in lighting, but for some reason, the script doesn't change the parents or changes some of the lighting settings, if anyone can help, I would appreciate it
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["CurLevel"]
local function setParent(children, parent)
for _, child in ipairs(children) do
child.Parent = parent
end
end
curlev.Changed:Connect(function()
if curlev.Value == 0 or curlev.Value == 1 then
setParent(LightingChildren, nil)
setParent(lobby, Lighting)
Lighting.Brightness = 0
Lighting.Ambient = Color3.fromRGB(0,0,0)
Lighting.OutdoorAmbient = Color3.fromRGB(0,0,0)
elseif curlev.Value == 4 then
setParent(LightingChildren, lobby)
setParent(abandonedoffice, Lighting)
Lighting.Brightness = 1
Lighting.Ambient = Color3.fromRGB(22,22,22)
Lighting.OutdoorAmbient = Color3.fromRGB(0,0,0)
end
end)

1 comment
i see the problem now, it was tryna parent to all the children in the folder, thanks for this