Basically, what is going on with that part of the code is that
Direction is a unit vector value, which means it is pointing to where the door will move.
Increment is how much you want the door to move in that direction.
Direction*Increment is essentially a distance in a direction with the length of the increment
Part.CFrame + (Direction*Increment) means that part's position will have the position of the direction added to it's own position resulting in the part moving.
wait((Time/Mag)*Increment means that the Time it will take to move the part will be divided by the Distance between where you want the part to be and having the Increment you move it by multiplied to that value since you count up by that increment.
In order for the loop to take the proper time you want it to take, the time needs to be divided by the distance and multiplied by the increment since you use that increment to count up to that magnitude.
1 comment
Can you communicate the code to me how it works?