--LightSwitch also found in Suburban


local interactive = script.Parent.Interactive
local lights = {}
local switch = "up"
local sound = interactive.Sound

function CheckChildren(obj)
	for i, v in pairs(obj:GetChildren()) do
		if v:IsA("BasePart") and v.Name == "Light" then
			table.insert(lights,v)
		end
		CheckChildren(v)
	end
end

CheckChildren(script.Parent.Parent)

interactive.ClickDetector.MouseClick:Connect(function(player, part)
	if script.Parent.Parent.LightsOn.Value == false then
		script.Parent.Parent.LightsOn.Value = true
		for i = 1, #lights do
			lights[i].PointLight.Enabled = true
			lights[i].Material = Enum.Material.Neon
		end
	else
		script.Parent.Parent.LightsOn.Value = false
		for i = 1, #lights do
			lights[i].PointLight.Enabled = false
			lights[i].Material = Enum.Material.SmoothPlastic
		end
	end
	if switch == "up" then
		switch = "down"
		script.Parent.Interactive.CFrame = script.Parent.Interactive.CFrame * CFrame.Angles(math.rad(-10),0,0)
	else
		switch = "up"
		script.Parent.Interactive.CFrame = script.Parent.Interactive.CFrame * CFrame.Angles(math.rad(10),0,0)
	end
	sound:Play()
end)
