I want to start off by pointing out that :MakeJoints() has become deprecated, so I am looking for an alternative. I use :MakeJoints() to create joints between 2000+ part destructible models with little to no performance impact. However, when I use a script like qPerfectionWeld, and destroy a single part, I run into lag spikes where individual frames take 300+ ms to render with no physics updates. In my specific use case, I can not see a viable alternative to :MakeJoints(), but I really don’t like using deprecated stuff. Is it fine to use it for the time being, or is there a non-deprecated alternative?
Simple joint making loop example:
for _, jModel in pairs (newMap:GetChildren()) do
if jModel:FindFirstChild("JointObj") then -- "JointObj" is simply an empty value that tells me which models within the main model need joints made.
jModel:MakeJoints() -- Very little performance impact, but is deprecated.
end
end
The models which are being welded together are all unanchored so they can be manipulated and destroyed. Is there a way to generate welds automatically with touching parts within studio?
I just select whatever models in workspace that need welding, then run this code in the command bar, and it welds whatever touching parts together
local function weldModel(model)
for _, v in pairs(model:GetChildren()) do
if v:IsA("BasePart") then
workspace:JoinToOutsiders({v}, Enum.JointCreationMode.All)
else
weldModel(v)
end
end
end
for _, v in pairs(game.Selection:Get()) do
weldModel(v)
end