✓ Accepted answer
You can rotate and move models using :PivotTo(). This is function that can be used to make a model to go a CFrame with a set angle. To make the model only rotate, this can be easily done.
Try this piece off code:
script.Parent.Touched:Connect(function()
game.Workspace.MainDoor:MoveTo(Vector3.new(73.366, 3.843, -7.959))
game.Workspace.MainDoor:PivotTo(game.Workspace.MainDoor:GetPivot() * CFrame.Angles(math.rad(90,0,0),0,0))
script.Parent:Destroy()
end)
All that I have added is game.Workspace.MainDoor:PivotTo(game.Workspace.MainDoor:GetPivot() * CFrame.Angles(math.rad(90,0,0),0,0)), so I will explain that now.
First, we get the model which is the MainDoor. We then call :PivotTo(). This will be used to change the pivot. In the brackets, we then get the model again and call :GetPivot() to get the model's current pivot. We then times that pivot by a angle cframe, 90, 0, 0. math.rad converts an angle in degrees to radians. This should then rotate the model.
Some useful links:
Edit: I have replaced game.Workspace.MainDoor:PivotTo(game.Workspace.MainDoor:PivotTo:GetPivot * CFrame.Angles(math.rad(90,0,0),0,0)), with game.Workspace.MainDoor:PivotTo(game.Workspace.MainDoor:GetPivot() * CFrame.Angles(math.rad(90,0,0),0,0)), so I will explain that now. to fix a error
4 comments
We were already helping you on your other question... Why did you create a new one?
Hi there, I've already solved the problem on the other post recently, but I'm not sure how to change the orientation now.
I don't understand why are you using :MoveTo to move a model. Use :SetPrimaryCFrame() instead (altrough it's deprecated). It has much more possibilites.
I would like to use CFrame but I don't know how to use it to make it go to the specific coord I want