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

How do I make a model unanchor in one piece?

Asked by 4 years ago

I tried

script.Parent.Anchored = true

wait(21)
script.Parent.Anchored = false

It won't work, if I put the script into all of the parts of the model they break off separately, thanks for your time

3 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

To keep all parts of a model "glued" together, you need to use Weld objects. Here's a simple welding script that you can place within your model. Make sure to assign a PrimaryPart for the model inside of the model's Properties (this can be any part within the model), Keep the entire model anchored (the script will unanchor it for you, if it starts unanchored it will break) and put this script within the model:

local model = script.Parent
local primary = model.PrimaryPart
local modelParts = model:GetDescendants()

for i = 1, #modelParts do
    local part = modelParts[i]
    if part:IsA("BasePart") and part ~= primary then
        local weld = Instance.new("Weld", primary)
        weld.Part0 = primary
        weld.Part1 = part
        weld.C0 = primary.CFrame:Inverse()
        weld.C1 = part.CFrame:Inverse()
        part.Anchored = false
    end
end
primary.Anchored = false

If you have any questions or problems with this answer, let me know. I'd be happy to clarify or fix it.

Hope this helps!

Ad
Log in to vote
0
Answered by
Arj783 72
4 years ago

I'm not very good with scripting, and I don't really specialize in this, but I think you're supposed to do ":MakeJoints". Try it out, because I'm not sure. Maybe it's for humanoids, but I'm not sure. Hope this helps!

0
Yea I don't think that's gonna work... Arj783 72 — 4y
Log in to vote
0
Answered by
haba_nero 386 Moderation Voter
4 years ago

Try using a special plugin! It is called "Insta-Weld" and it welds everything instantly that you have selected. After you have installed it from this link: https://www.roblox.com/library/148570182/Weld-Plugin just click weld all and you are done!

Hope this helps! TIP: You can also use unions.

Answer this question