:I'm making a script that lets you move models in-game, but I don't know how to do this without moving each part individually. Most of my structures are pretty detailed and can use dozens of parts, so I'm not too keen on going that route. Is there any way to move the entire model through script?
How would I move an entire model rather than each part individually in a model?
3 answers
workspace.Model:MoveTo(Vector3.new(x,y,z))
but again if the model is inside of something it will raise the Y value (go upward) until nothing is in the way. When moving a model, it uses the PrimaryPart chosen. If no primary part is chosen it will use the root part of the model.
If you dont want to worry about that, you can do this
local model = game.Workspace.Model
model:SetPrimaryPartCFrame(CFrame.new(5,5,5)) -- 5,5,5 can be any position you want
2 comments
The second script worked, thanks for all your help :)
np :)
If you want to move it just do this. Pretend the model is in workspace and named "Model"
workspace.Model:MoveTo(12,42,14) -- Just put in the cordinates
5 comments
First off, that was quick :D, second this answer is kind of vague, I'd need to know how to get the position of the "center" of the model because it's required for the scripts I'm using.
This moves the model to the desired coordinates, but it moves on top of whatever is there. I suggest using SetPrimaryCFrame instead (Look it up), It sets the model's primary part to the excat location
Jeez these answers are comin in fast XD, finally I tried the method in the answer and it just gave me an error "Unable to cast double to Vector3", so I'll see if the SetPrimaryCFrame is any good.
^ gold forgot to add “Vector3.new()” into the parentheses which is why you’re getting an error. Just add that in the parentheses and put the numbers in the parentheses of the “Vector3.new()”.
of you could do MoveTo(Vector3.new(12,42,14)) although MoveTo is not the best way ever to move a model but it is easy
The best way to go at this would be to use :SetPrimaryPartCFrame
Of course, you'll need to make sure that the model has a primary part set.
An example:
local model = game.Workspace.Part
local part = game.Workspace.MovePart
model:SetPrimaryPartCFrame(movepart.Position)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
http://wiki.roblox.com/index.php?title=API:Class/Model/SetPrimaryPartCFrame