PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

MoveTo

Moves the Model/PrimaryPart to the given position. If a primary part has not been specified then the root part of the model will be used. Because the root part is not deterministic, it is recommended to always set a Model/PrimaryPart when using MoveTo.

If there are any obstructions where the model is to be moved to, such as Terrain or other BaseParts, then the model will be moved up in the Y direction until there is nothing in the way. If this behavior is not desired, Model/SetPrimaryPartCFrame should be used instead.

Note that rotation is not preserved when moving a model with MoveTo. It is recommended to use either Model/TranslateBy or Model/SetPrimaryPartCFrame if the current rotation of the model needs to be preserved.

Parameters

Name Type Default Description

The DataType/Position the Model is to be moved to.

Returns

Return Type Summary

Code Samples


Model MoveTo

This sample demonstrates how Model:MoveTo avoids collisions.

A simple two part Model is created, and its PrimaryPart is set. An large obstruction part is placed next to it.

After 5 seconds Model:MoveTo is used to direct the model to move inside the obstruction part. However, as MoveTo will not move a model inside of an obstruction the Model is moved up on the Y axis and placed above the obstruction.