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

How do I clone a model and set its position?

Asked by 6 years ago
Edited by OldPalHappy 6 years ago

I have a box that is a model, but I want to know where to keep it. ReplicatedStorage? Also, how do I clone the whole model and set its position to a part's position?

2 answers

Log in to vote
1
Answered by
njesk12 25
6 years ago

Assuming you have set the primary part for a model, you can use this as a reference and thereafter just use the SetPrimaryPartCFrame function of a cloned model - using the :Clone() function on the model.

For help on the :Clone() function use this as a guide.

Hope this helps!

Ad
Log in to vote
-1
Answered by
Elixcore 1337 Moderation Voter
6 years ago

Keeping models in ReplicatedStorage is a good idea because LocalScripts can also use it, i'd say either use ReplicatedStorage or ServerStorage.

model = game.YourModelsLocation:Clone() -- put the model's location after "model ="
model.Parent = workspace -- the model's parent, for example Workspace.
model.Part.Position = part.Position   -- you cannot use CFrame or Position on a model so you have to use a part inside the model as the CFrame or Position.

Answer this question