goal.Transparency=1 door.PrimaryPart.Transparency=1 local function S(S,z,m)local r=Instance.new("\067\070\114\097\109\101\086\097\108\117\101")r.Value=S:GetPrimaryPartCFrame();(r:GetPropertyChangedSignal("\086\097\108\117\101")):Connect(function()S:SetPrimaryPartCFrame(r.Value)end)local Y=tweenService:Create(r,m,{Value=z})Y:Play()Y.Completed:Connect(function()r:Destroy()end)end local function z()if canOpen then canOpen=false if open then open=false S(door,origCFrame,TweenInfo.new(downtime))else open=true S(door,goal.CFrame,TweenInfo.new(uptime))end wait(waitTime+uptime)canOpen=true end end clickDetector.MouseButton1Click:connect(z)
--yep

goal.Transparency = 1
door.PrimaryPart.Transparency = 1

local function tweenModel(model, CF, info)
	local CFrameValue = Instance.new("CFrameValue")
	CFrameValue.Value = model:GetPrimaryPartCFrame()

	CFrameValue:GetPropertyChangedSignal("Value"):Connect(function()
		model:SetPrimaryPartCFrame(CFrameValue.Value)
	end)

	local tween = tweenService:Create(CFrameValue, info, { Value = CF })
	tween:Play()

	tween.Completed:Connect(function()
		CFrameValue:Destroy()
	end)
end

local function onClicked()
	if canOpen then
		canOpen = false

		if open then
			open = false

			tweenModel(door, origCFrame, TweenInfo.new(downtime))
		else
			open = true

			tweenModel(door, goal.CFrame, TweenInfo.new(uptime))
		end

		wait(waitTime + uptime)
		canOpen = true
	end
end

clickDetector.MouseButton1Click:connect(onClicked)
