Welds break when map loads

My game requires welds between parts for my maps for destruction. My problem stems from trees:

image

Each tree has exactly 1 leaf and 1 log. There are 2 welds inside the log that weld the log to the leaves and the log to the anchored baseplate

image

The entire map is anchored within ServerStorage. It then gets loaded into workspace and unanchored with this method:

for i, v in map:GetChildren() do
	local newV = v:Clone()
	newV.Parent = game.Workspace.Map.Destructable
	if newV:IsA("Model") then
		newV:MakeJoints()
	end
end

-- Unanchor all the parts with welds

But this method has a problem:

The trees lose their welds for some reason:
image

Specifically, they lose their welds to the anchored baseplate and I have no clue why this happens or how to fix it.

The only thing that has seemed to IMPROVE the problem was to avoid changing the collision group of the parts during the games runtime. This still isnt a definite fix though :frowning:

1 Like

why donā€™t you just anchor the trees?

1 Like

Why so many welds?
You only need one WeldConstraint between the log and the leaves, and one WeldConstraint from the weld to the baseplate.
They donā€™t need to be Anchored in the ServerStorage if they donā€™t need to be in the game.
The other thing is if you are calling ModelMakeJoints does that affect the WeldConstraints? The issue I see is if you use MakeJoints and the surfaces are smooth (not SmoothPlastic, but Smooth, not a Weld, Glue, Stud, Inlet or any of the old deprecated joints) then then " * Smooth surfaces will not create joints" according to the linked info. It also only makes joints on items that are planar to each other (flat against each otherā€™s surface), but your trees arenā€™t like that.

Check your WeldConstraints to make sure the Part0 and Part1 properties are set in Studio.

2 Likes

I think when a weld is copied, you need to set its part0 and part1 again.

1 Like

Iā€™d highly recommend having one anchored ā€œmasterā€ part (best choice here would be the trunk) and welding that to all the other unanchored ā€œsubordinateā€ parts (best choice here are the leaves.) Set the CFrame of the tree trunk, not the position. Centax and I commonly used this to handle tower models in PSTD.

2 Likes

Because the destruction of the game requires the parts to not be anchored, but rather welded to an anchored baseplate part.

The MakeJoints() call was from another soltuion I tried and forgot to remove. They are welded properly in studio too.

Also what do you mean by ā€˜so many weldsā€™? Every destructable part in the map needs to be welded for destruction to work.

That question was due to the fact you had the MakeJoints section.
If you have just the two welds required then itā€™s all good.

1 Like