How to get the parts that is not selected with in pairs

Hello i am trying to make a game where you have to switch levers to get thru obstacles but i want other levers to close when i open a lever.

so i just need to know how can i get all the other levers that is not clicked at the time

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

while task.wait() do
	local Switchs = game.Workspace.Switchables:GetChildren()



	for i,v in pairs(Switchs) do
		if Mouse.Target == v then
			print("Showing")
		end

		v.ClickDetector.MouseClick:Connect(function(Switch)
			local Traps = v:GetChildren()
			for i,v in pairs(Traps) do
				if v:IsA("BasePart") then
					v.Transparency = 1
					v.CanCollide = false
				end
			end
		end)
	end
end
1 Like

You can insert a BoolValue inside each switch that would be set to true when it is switched on, then false when switched off

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.