there's models inside of models its a tycoon.. i want to put it in server storage then clone it and re-position it with a script
There are many ways you can go about Re-Positioning a model. But i'll explain how to get the current Position
of a model, and the top 3(In my opinion) ways to re-position a model.
You can get the current Position of a model two ways. The first way being using the GetPrimaryPartCFrame
method, and the second being using the GetModelCFrame
method.
1) The GetPrimaryPartCFrame() method will return the Model's PrimaryPart CoordinateFrame
, which is the proper term for CFrame. If PrimaryPart is nil(non-existant) then it will return
an error in the output.
2) The GetModelCFrame() method will return the Model's average CFrame, which is a CFrame computed by using all the parts in the model's CFrames' and Size Extents. This way is much more accurate as far as the real CFrame of the Model than using choice 1.
Top 3 ways to position the model;
1) The SetPrimaryPartCFrame() method takes an argument which should be the CFrame you would like to reposition the object to. This will return an error if the PrimaryPart of the model is not set. This will overlap objects.
model:SetPrimaryPartCFrame(CFrame.new(10,0,0))
2) The TranslateBy() method takes an argument wich should be the offset point
of which to CFrame the model from it's current Position, using a Vector3. This will overlap objects as well. For example, if I wanted to move the model 10 studs to the right from it's current position I would do..
model:TranslateBy(Vector3.new(10,0,0))
A good way to use this for CFraming the model would be finding the difference in CFrames, then using that as the offset, or arguments for the method.
3) Lastly, the MoveTo() method takes an argument which should be the Position you'd like to move the model to, in the form of a Vector3. This will not overlap objects, it will snap above any object in the way.
model:MoveTo(Vector3.new(10,0,0))