So I want to duplicate a model of an R15 rig, and then I want to move the position of all the parts that can have their position moved. I started using an in pairs loop to get all the parts. But then I don't know what to do from there. I was thinking maybe doing every part that can be moved in the model and teleporting it, but that can't be efficient.
This is the script I'm thinking of:
--Sorry for the sloppy script
for i,v in pairs(Cv:GetChildren()) do
if v.Name == "LeftFoot" then
v.Position = game.Workspace.EnemySpawn.Position
end
if v.Name == "RightFoot" then
v.Position = game.Workspace.EnemySpawn.Position
end
if v.Name == "LeftLowerArm" then
v.Position = game.Workspace.EnemySpawn.Position
end
if v.Name == "LeftUpperArm" then
v.Position = game.Workspace.EnemySpawn.Position
end
if v.Name == "RightLowerArm" then
v.Position = game.Workspace.EnemySpawn.Position
end
if v.Name == "RightUpperArm" then
v.Position = game.Workspace.EnemySpawn.Position
end
if v.Name == "LeftHand" then
v.Position = game.Workspace.EnemySpawn.Position
end
if v.Name == "RightHand" then
v.Position = game.Workspace.EnemySpawn.Position
end
end
I was just wondering if the fine people of scripting helpers could help me find a more efficient way. Thank you for your time.

3 comments
I would use Model:SetPrimaryPartCFrame()
Set a PrimaryPart on the model by clicking the property and then the part inside the model you want it to be the PrimaryPart. Then on the script use model:SetPrimaryPartCFrame(CFrame). It will change the CFrame of the primary part you have set and the other model parts will keep their position/orientation in relation to the primary part.
Set a PrimaryPart on the model by clicking the property and then the part inside the model you want it to be the PrimaryPart. Then on the script use model:SetPrimaryPartCFrame(CFrame). It will change the CFrame of the primary part you have set and the other model parts will keep their position/orientation in relation to the primary part.