--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)
