Basically I just need help on the part of the code where the block will return I have it set to wait 2 seconds then it will move back by it's self, but I want it to move back once I click the button again. Could I get some help please? Thanks!

d = false
function onClicked()
	if d == false then
		d = true
		
		print("Moving Brick To Right")
		script.Parent.Parent.DoorButton.BrickColor = BrickColor.new("Really red")
		for i = 1,49 do
		script.Parent.Parent.Door.CFrame = script.Parent.Parent.Door.CFrame * CFrame.new(0, 0, 0.244) * CFrame.fromEulerAnglesXYZ(0,0,0)
		wait()
		end
		
		-- I need this section to move after I click the brick once again but I can't figure it out
		wait(2)
		script.Parent.Parent.DoorButton.BrickColor = BrickColor.new("Lime green")
		print("Moving Brick To Left")
		for i = 1,49 do
		script.Parent.Parent.Door.CFrame = script.Parent.Parent.Door.CFrame * CFrame.new(0, 0, -0.244) * CFrame.fromEulerAnglesXYZ(0,0,0)
		wait()
		end
		d = false
		end
	end
script.Parent.ClickDetector.MouseClick:connect(onClicked)