I’ve recently been working on a door framework for my game.
It all seemed to work fine, and still does. Except for the fact that as of recently, any new doors don’t work.
I use WeldConstraints to move the objects, and that’s been working fine for me.
But now, whenever I copy any of the doors (even if duplicating, or using ctrl+c; they’re the exact same), the welds fail to work on them.
The welds go inactive without any apparent reason. However, all old doors work just fine. This only happens with new doors.
I’m not sure what’s wrong.
function WeldModel(Main, Weld)
if not Main then return end
if not Weld then return end
for _, v in ipairs(Weld:GetDescendants()) do
if v ~= Main and v:IsA('BasePart') then
local weld = Instance.new('WeldConstraint')
weld.Part0 = v
weld.Part1 = Main
weld.Parent = v
v.Anchored = false
end
end
end
Keep in mind this code has worked since I first wrote it, and still does. The issue is that welds are going inactive for some reason.
When you copy the door, make sure to create NEW weld constraints for them too!
The old weld constraints work just fine, but you need to make new ones for the duplicated doors.
Unable to reproduce this problem at all. Here’s what I tried:
Created a brick.
Duplicated that brick and moved it slightly up.
Connected both bricks with a WeldConstraint.
Used the duplicate context option, moved it over.
Ctrl + C and Ctrl + V on both bricks, moved them over.
WeldConstraints never deactivated. The only circumstance that a WeldConstraint went inactive on me was when I toggled the anchored property on both connected parts.
Are you able to provide a repro file in which you encounter this issue or is the issue only observable to a specific assembly that you’ve created? If it’s specific to your assembly, it’s almost definitely a problem with your implementation. If you’re able to repro it on other assemblies, then the possibility of a bug is also thrown into the equation, though I doubt the latter is the case.
Problem is that the baseplate has a bunch of rigid welds in it which are holding the doors down and overriding the WeldConstraints. Delete all the welds in the baseplate and try again. Doors work fine, you just had some oversights you didn’t account for.
That’s odd. I don’t recall placing any welds at all in the baseplate. Might have to do with some recent roblox update. Will check if this fixes the issue when I can. Thanks for the discovery.
You can pass the descendants of each door through this function, which will return a list of connected parts via any kind of rigid joint. You can then iterate through the returned list of parts. For those that aren’t a descendant of the door model, break the joint between them.
I ran this function on a part of one of the “faulty” doors and the Baseplate was in the returned array.
I’m not sure I understand your response clearly. As far as baseplate welds go though, this most likely has to do with the new part surface behaviour that creates welds when you drag bricks around. T
I noticed it happens for me too. Turn off “Join Surfaces”.