# Destroy welds on collide with enough momentum

So I’m trying to make a destruction system with some trains, and currently, all weld destruction is based on explosions. However, collisions don’t faze my models at all. Is there a weld type or method to make welds on parts break when they’re hit at a certain speed? I remember seeing a Twitter post about this, but I can’t seem to find it anymore.

Current idea - although repetitive - is to create a script on every part which destroys all Weld descendants when impacted. I’d like to know if anyone has better ideas, or if this is just a part of default Roblox that I missed.

1 Like

I think that’s what the Glue instance does.

@krasycheckz Glue joints are deprecated.
New Physics Class: RigidConstraint were just announced last month.
Maybe give them a while to perfect them.

1 Like

Yes, but if you follow the Glue | Roblox Creator Documentation link listed there you’ll see it’s been deprecated.

I came up with a little code snippet to do this for me. First, I weld all the parts in a model, then insert a script into the main part of the model.

``````local min = workspace.MinImpactSpeed.Value
--Sets a minimum from an IntValue in the workspace

local function jointbreak(part)
--Repetitive function that checks if the velocity on any combination of axes is big enough
if not part:IsDescendantOf(model.Parent) then
if (math.abs(model.AssemblyLinearVelocity.X) + math.abs(part.AssemblyLinearVelocity.X) >= min) or
(math.abs(model.AssemblyLinearVelocity.X) + math.abs(part.AssemblyLinearVelocity.Y) >= min) or
(math.abs(model.AssemblyLinearVelocity.X) + math.abs(part.AssemblyLinearVelocity.Z) >= min) or
(math.abs(model.AssemblyLinearVelocity.Y) + math.abs(part.AssemblyLinearVelocity.Y) >= min) or
(math.abs(model.AssemblyLinearVelocity.Y) + math.abs(part.AssemblyLinearVelocity.Z) >= min) or
(math.abs(model.AssemblyLinearVelocity.Z) + math.abs(part.AssemblyLinearVelocity.Z) >= min) then model.Parent:BreakJoints()
end
end
end

script.Parent.Touched:Connect(jointbreak) -- If touched at speed, break
``````

I plan on replacing this function with the RigidConstraint once it’s complete. If anyone has suggestions, I’d be willing to try.

1 Like