Why does my cframe error?

code:

local debounce = false
local open = false
local ts = game:GetService("TweenService")
local ti = TweenInfo.new(2,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out
)
local ti2 = TweenInfo.new(2,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out
)
local di = TweenInfo.new(.5,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.Out
)
local di2 = TweenInfo.new(2,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out
)
local tg = {CFrame = workspace.Technical.Door.Welds.CFrame * CFrame.Angles(0, math.rad(160), 0)}
local tg2 = {CFrame = workspace.Technical.Door.Welds.CFrame - CFrame.Angles(0, math.rad(160), 0)}

tc = ts:Create(workspace.Technical.Door.Welds, ti, tg)
tc2 = ts:Create(workspace.Technical.Door.Welds, ti2, tg2)
script.Parent.ClickDetector.MouseClick:Connect(function()
		if open == false then
		tc:Play()
		script.Parent.DoorOpen:Play()
		open = true
	else
		tc2:Play()
		script.Parent.Doorclose:Play()
		open = false
	end
end)

the error is “Expected vector3, got CFrame” the code i copied the Cframe part from worked. it’s basically identical. i’m not using debounce yet.

You cannot subtract a CFrame from a CFrame, it needs to be a Vector3

how will i use the rotation though?

Multiply it by a negative CFrame or make the angle negative

change this to /

local tg2 = {CFrame = workspace.Technical.Door.Welds.CFrame / CFrame.Angles(0, math.rad(160), 0)}

or you could change it to negative and multiply as @HugeCoolboy2007 said.

ight, but it does this:

For opening a door from a specific angle (I’m assuming you want the door to open from the right), you’ll need to also utilize mechanical constraints

https://create.roblox.com/docs/tutorials/building/physics/building-a-hinged-door

Unless I’m missing the goal here

i’m using welds and tweens, i want the door to open when you click it

Have you tried using CFrame:ToObjectSpace

no, i don’t really know CFrames that well. mind explaining it to me?