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

How can I make a model break? [closed]

Asked by 10 years ago

Hi, just say I have a model of a bridge. How can I make it all fall apart/collapse?

Locked by youtubemasterWOW

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

3 answers

Log in to vote
2
Answered by
Everesty 1006 Moderation Voter
10 years ago

You can loop through all of the parts and set their Anchored property to false.

for i,v in pairs(YourBridge:GetChildren()) do
    if v:IsA("BasePart") then
        v.Achored = false
    end
end
0
Thank you. OfficialAndrew 45 — 10y
Ad
Log in to vote
1
Answered by 10 years ago

Or if it's Welded then it would be

for i,v in pairs(game.Workspace.Bridge:GetChildren()) do
    if v:IsA("BasePart") then
        v:BreakJoints()
    end
end

Log in to vote
1
Answered by
Azarth 3141 Moderation Voter Community Moderator
10 years ago

Adding on to what 18 said, incase there are nested models/parts.

function breakModel(obj)
    for i,v in pairs(obj:GetChildren()) do 
        if v:IsA("BasePart") then 
            v.Anchored = false
            v:BreakJoints()
        end
        breakModel(v)
    end
end

breakModel(Workspace["ModelName"])