This isn’t an error, this is a problem with your implementation. There’s literally only one correction you have to make: the fact that you’re using the CFrame of door(1) for door2.
-- Use local variables and prevent writing repetitive statements
local doorGroup = script.Parent.Parent
local door = doorGroup.door
local door2 = doorGroup.door2
local function onClicked()
for i = 1, 70 do
door.CFrame = door.CFrame * CFrame.new(0, 0, 0.1)
-- This is where your issue was: using door.CFrame over door2.CFrame
door2.CFrame = door2.CFrame * CFrame.new(0, 0, 0.1)
wait()
end
wait(3)
for i = 1, 70 do
door.CFrame = door.CFrame * CFrame.new(0, 0, -0.1)
-- This is where your issue was (again)
door2.CFrame = door2.CFrame * CFrame.new(0, -0, 0.1)
wait()
end
end
-- Use PascalCase Connect; lowercase connect is deprecated
script.Parent.ClickDetector.MouseClick:Connect(onClicked)
As a little addendum, I don’t typically recommend CFraming doors in this fashion. I created a tutorial on model tweening which allows you to smoothly move multiple-part doors and other kinds of assemblies. You can read up on that here: