Having trouble setting a CFrame to a part inside of a model

I’m trying to make a door swing open using TweenService and when trying to get the CFrame of the models PrimaryPart, for some reason I get the error: CFrame is not a valid member of Model even though I’m not trying to get the CFrame of the model. Here’s the doors code:

-- Variables

local ServerStorage = game.ServerStorage;
local Doors = ServerStorage.Doors;
local DoorPrompts = ServerStorage.DoorPrompts;

local RunService = game:GetService("RunService");
local TweenService = game:GetService("TweenService");

--

-- Functions

local function OpenDoor(door, speed, angle)
	
	-- Variables
	
	local hinge = door.Hinge;
	local offset = hinge.CFrame:Inverse() * door.CFrame;
    
    -- Create tweenInfo 
	
	local doorSettings = TweenInfo.new(
		speed,
		Enum.EasingStyle.Linear,
		Enum.EasingDirection.Out,
		0,
		false,
		0
	);
	
	-- Create tween
	
	local angleGoal = {CFrame = hinge.CFrame * CFrame.Angles(0, math.rad(angle), 0) * offset};
	local openTween = TweenService:Create(door, doorSettings, angleGoal);
	openTween:Play();
end    

wait(3)
OpenDoor(workspace.InsideHouse.Bedroom.Doors.Door, 1, 90);

I’ve looked everywhere online (and the developer forum) and I can’t seem to find a solution. Help is appreciated.

It looks like you are creating the tween with the door, which is a model (as you specified in the arguments of the OpenDoor function when you called it).
Instead, create a primary part of the model and tween that, not the door.

Sorry, I should’ve been more specific. The line that is causing this error is this line:

You have most likely selected a Model in the parameters.

Maybe it will work by adding .PrimaryPart after “Door”, if you have one set, or by selecting the exact part you want to tween. Keep in mind to move the whole door (if you have more than 1 parts), you need to weld the parts to the PrimaryPart of the Model or to any part you want to have as the PrimaryPart, and unanchor all of them except of the “PrimaryPart”. Since that’s the part you’d need to move at the end.

1 Like

Ok I found the issue. It’s this segment right here:

Looks like I was accidentally getting the CFrame of the model. OOPS!