local P=script.Parent.ClickDetector function onMouseClick()if script.Parent.CanCollide==false then print("\067\108\111\115\101 \100\111\111\114")local P=script.Parent.Parent:GetChildren()for N=1,#P,1 do if P[N].className=="\080\097\114\116"or P[N].className=="\083\101\097\116"or P[N].className=="\087\101\100\103\101\080\097\114\116"or P[N].className=="\067\111\114\110\101\114\087\101\100\103\101\080\097\114\116"or P[N].className=="\086\101\104\105\099\108\101\083\101\097\116"or P[N].className=="\085\110\105\111\110\079\112\101\114\097\116\105\111\110"then if P[N].Name=="\087\105\110\100\111\119"then P[N].Transparency=.6 else P[N].Transparency=0 end P[N].CanCollide=true end end else print("\079\112\101\110 \100\111\111\114")local P=script.Parent.Parent:GetChildren()for N=1,#P,1 do if P[N].className=="\080\097\114\116"or P[N].className=="\083\101\097\116"or P[N].className=="\087\101\100\103\101\080\097\114\116"or P[N].className=="\067\111\114\110\101\114\087\101\100\103\101\080\097\114\116"or P[N].className=="\086\101\104\105\099\108\101\083\101\097\116"or P[N].className=="\085\110\105\111\110\079\112\101\114\097\116\105\111\110"then P[N].Transparency=1 P[N].CanCollide=false end end end end P.MouseClick:connect(onMouseClick)
--Simple function to make the door appear and disappear

local clickDetector = script.Parent.ClickDetector

function onMouseClick()
	if script.Parent.CanCollide == false then
		print("Close door")
		local C = script.Parent.Parent:GetChildren()
		for i = 1, #C do
			if
				(C[i].className == "Part")
				or (C[i].className == "Seat")
				or (C[i].className == "WedgePart")
				or (C[i].className == "CornerWedgePart")
				or (C[i].className == "VehicleSeat")
				or (C[i].className == "UnionOperation")
			then
				if C[i].Name == "Window" then
					C[i].Transparency = 0.6
				else
					C[i].Transparency = 0
				end
				C[i].CanCollide = true
			end
		end
	else
		print("Open door")
		local C = script.Parent.Parent:GetChildren()
		for i = 1, #C do
			if
				(C[i].className == "Part")
				or (C[i].className == "Seat")
				or (C[i].className == "WedgePart")
				or (C[i].className == "CornerWedgePart")
				or (C[i].className == "VehicleSeat")
				or (C[i].className == "UnionOperation")
			then
				C[i].Transparency = 1
				C[i].CanCollide = false
			end
		end
	end
end

clickDetector.MouseClick:connect(onMouseClick)
