Break all welds when any part in a model is touched

I don’t quite know where to start here, I have a model with various parts and I want all their welds to “break” when anything external touches these parts (player, car, etc).

Where could I start?

I believe there is a method called :BreakJoints() for a model.

local connections = {} -- to save memory

for _, part in model:GetChildren() do
    table.insert(connections, part.Touched:Connect(function(hit)
        if hit.Parent ~= model then
            model:BreakJoints()
            
            for _, connection in connections do
                connection:Disconnect()
            end
        end
    end))
end

Untested code, you could write something similar to this.

1 Like