Hello
I am trying to move a model using script but for some reason, it is not working. ('Door' is the model. I have set the model's primary part to the main part inside the model already)
1 | script.Parent.Touched:Connect( function () |
2 | game.Workspace.Door:MoveTo(Vector 3. new( 87.065 , 3.843 , - 16.842 )) |
3 | script.Parent:Destroy() |
4 | end ) |
You cannot move a model like that, you must move the primary part of the model instead. I also believe MoveTo only works with humanoids. try:
1 | script.Parent.Touched:Connect( function () |
2 | game.Workspace.Door.PrimaryPart.Position = Vector 3. new( 87.065 , 3.843 , - 16.842 ) |
3 | script.Parent:Destroy() |
4 | end ) |
Someone else suggested using Model.PrimaryPart.Position
, but I suggest you use Model:SetPrimaryPartCFrame(CFrame)
if you are trying to move parts and keep constant offset.
Sorry. I figured out the issue. The script was correct but all my other models were named Door. To fix this issue, I simply changed my main door model to another name.