Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is there a way to move all parts of a model when cloning a model?

Asked by 3 years ago

I need to clone an object from rep storage with a script, and I know how, but I'm just wondering if there's a way I can move every single part part in the model to its position relative to that model without scripting every part to go to a position.

1 answer

Log in to vote
0
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
3 years ago

You can use a function of Model known as :MoveTo(). This will set the PrimaryPart's position to any given Vector3.

Note: You must set a PrimaryPart before proceeding.

workspace.Model:MoveTo(Vector3.new(0, 0, 0))
0
Another method with more utility would be model:SetPrimaryPartCFrame(CFrame.new(...)). MoveTo does not allow for rotations. climethestair 1663 — 3y
0
Thank you for suggesting this alternative! Ziffixture 6913 — 3y
1
I prefer SetPrimaryPartCFrame in most cases for the rotation as well as the lack of collision. Make sure to set a primary part though! DinozCreates 1070 — 3y
0
Thank you Ziffixture that worked frogeater12345 -3 — 3y
Ad

Answer this question