In trying to make a boat, I need to weld the entire thing together with ManualWelds. So in doing so, I've managed to weld every BasePart together except for seats, which is to say that Seats don't get welded, while everything else does properly. I added the following line of code:
print(child.Name.." , the "..child.ClassName.." has been successfully welded to "..script.Parent.Primary.Name)
And it printed, "PilotSeat , the Seat has been successfully welded to Primary"
Though, when I tested it and looked in the explorer, there was no weld parented to the seat, even though the script is supposed to parent the ManualWeld to the children of the model, and the line which appeared in the output.
Below is the entire script.
local function weldBetween(a, b)
--Make a new Weld and Parent it to a.
if a.ClassName == "Part" or a.ClassName == "UnionOperation" then
local weld = Instance.new("ManualWeld", a)
weld.Part0 = a
weld.Part1 = b
weld.Name = "Weld"
--Get the CFrame of b relative to a.
weld.C0 = a.CFrame:inverse() * b.CFrame
--Return the reference to the weld so that you can change it later.
return weld
end
end
for index, child in pairs(script.Parent:GetChildren()) do
print(child.ClassName)
if child.ClassName == "Part" or child.ClassName == "UnionOperation" or child.ClassName == "Seat" then
print(child.Name.." , the "..child.ClassName.." has been successfully welded to "..script.Parent.Primary.Name)
weld1 = weldBetween(child, script.Parent.Primary)
child.Anchored = false
end
end
Thanks for the help!

1 comment
Or simply use
a:IsA("BasePart")and it will return true if that object inherits from base part