TweenService Expected Vector3 got CFrame

I’ve been trying to make a sliding door using the TweenService. When I create the tween, it throws an error saying Expected Vector3, got CFrame. Although I want it to use a CFrame position. Here is the snippet of code producing the error:
position1.Position = CFrame.new(script.Parent.Door.CFrame * CFrame.new(4,0,0))
position1 is an empty table at the start. How do I use CFrame when it wants a Vector3?

Well I mean, you’re trying to use CFrame for Position. Position is a Vector3, CFrame is a CFrame.

Change that to

position1.CFrame = script.Parent.Door.CFrame * CFrame.new(4, 0, 0)

This is the Vector3 equivalent of @colbert2677’s post:

position1.Position = script.Parent.Door.CFrame * Vector3.new(4,0,0)

I tried replacing position with CFrame but it still returned the same error.

That worked. Thanks for the help.

1 Like

Just to clarify, the error with your code came from putting a CFrame expression inside a CFrame constructor, which causes an error since there is no such constructor for this:

position1.Position = CFrame.new( --[[<< THIS PART]] script.Parent.Door.CFrame * CFrame.new(4,0,0) )

However, this still leads to an error because the .Position property of a Part is a Vector3 data type, not a CFrame data type. A mismatch of data types will also throw an error:

position1.Position --[[<< THIS PART]] = CFrame.new(script.Parent.Door.CFrame * CFrame.new(4,0,0))

Removal of the extra CFrame constructor paired with the change in field leads to @colbert2677’s solution:

Whereas the total change in perspective toward making this a Vector3 expression to match the new Position field is what leads to my solution:

Just to clarify, and for your future knowledge, both solutions would have worked.