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.