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

I want to weld all the parts in the model to the torso so why won it work?

Asked by
neoG457 315 Moderation Voter
9 years ago
    part = game.Workspace.Dragon:GetChildren()
        weld = Instance.new("Weld")
        weld.Part0 = game.Workspace.Dragon.Torso
        weld.Part1 = part
        weld.C1 = part.CFrame:toObjectSpace(game.Workspace.Dragon.Torso.CFrame)
        weld.Parent = game.Workspace.Dragon.Torso
        part.Anchored = false 

    end

This should Get all the parts in the model and weld it to the torso but it wont work.

1 answer

Log in to vote
2
Answered by 9 years ago
for a,b in pairs(game.Workspace.Dragon:GetChildren()) do 
if b:IsA("BasePart") then
    weld = Instance.new("Weld")
    weld.Part0 = game.Workspace.Dragon.Torso
    weld.Part1 = b
    weld.C1 = b.CFrame:toObjectSpace(game.Workspace.Dragon.Torso.CFrame)
    weld.Parent = game.Workspace.Dragon.Torso
    b.Anchored = false
end
end

Possibly could be because some of 'Dragons' children are not baseparts. I am not 100% sure because you didn't give any errors from output.

Ad

Answer this question