Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you unanchor a model?

How would you unanchor a model.. Would you set the primary part's anchored value to unanchored? :/

1 answer

✓ Accepted answer

If you need to unanchor all parts within the model, you can paste this script into the command bar:

local modelName = "" --add model name inside quotes
local model = workspace:FindFirstChild(modelName,true)
for _,part in pairs(model:GetDescendants()) do
   if part:IsA("BasePart") then
      part.Anchored = false
   end
end

If you want to keep the parts inside the model connected together, however, you would need to use a weld script, which may look something like this (continuing from the last script):

local centre = model.PrimaryPart
for _,part in pairs(model:GetDescendants()) do
   if part:IsA("BasePart") and part ~= model.PrimaryPart then
      local weld = Instance.new("Weld")
      weld.Part0 = model.PrimaryPart
      weld.Part1 = part
      weld.C1 = part.CFrame:toObjectSpace(model.PrimaryPart.CFrame)
      weld.Parent = model.PrimaryPart
   end
end

1 comment

0

Thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.