Moving a model door

Hello there,
I am trying to develop a door that opens automatically when someone is approaching and that closes automatically when no one is near.

I made the detection with .Touched event and .TouchEnded event. Each time a Humanoid touches the hitbox, it’ll insert its name in a table, and if it leaves, it’ll remove it. So I detect how many people are near the door to make it open by using #touching, that returns the number of names indexed in the latter table.

Now, I need to make the door move. Note that I’d like, if possible to make it move using EasingStyle and EasingDirection.

I tried TweenService but the problem is that the model is containing several children and it moves the primaryPart only. I wanted to associate that with model:SetPrimaryPartCFrame(basepart.CFrame) but the elements in the model were not following.

I intended to use Vector3():Lerp but it did not work either. (Yes I am dumb with these methods…)

Here is a sample of the whole code:

local TService = game:GetService("TweenService")
local tweenInfo =, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0)

local doorMainPart = script.Parent.doorModel.PrimaryPart

local tween = TService:Create(doorMainPart, tweenInfo, {Position = - doorMainPart.Size.X, doorMainPart.Position.Y, doorMainPart.Position.Z)})
for i = 0, 60, 1 do

Here is an explorer screen of the door:

  1. This method is not working ._.

  2. As I am based on the X Axis when moving the door, it’ll work properly only if the PrimaryPart (and at the same time the whole door) is goodly oriented. If we rotate it only at 90°, the door would just do something weird… (Should I use CFrame.lookVector method ?)

If you don’t understand anything, please let a post, I can do some screenshots to make you understand better.

Thank you for trying to help me !

There are plenty of resources out there on how to tween a model. I personally use the method detailed in this thread.