MakeJoints() Don't work properly

So i make a script that use MakeJoints() but when a large floating platform was joined to a pillar,Every block except the pillar broke without creating a weld join,But when a small 2 block floating platform was joined,It is joined.Im opting for build a boat like joining system

1 Like

Are you intending the parts to be in a model? If so then I’m guessing you want the parts to be welded to the closest parts rather then just the Model | Roblox Creator Documentation. If this is the case then you can do something like this:

local Model = PathToModel

local function WeldModel(model : Model, root : BasePart) -- function to call whenever you wish to weld the model
	if not (root or model.PrimaryPart) then
		local center = Instance.new("Part")
		center.Anchored = true
		center.Shape = Enum.PartType.Ball
		center.Transparency = 1
		center.Size = Vector3.new(1, 1, 1)

		local frame, size = model:GetBoundingBox()
		center.CFrame = frame
		center.Parent = model

		model.PrimaryPart = center
	else
		model.PrimaryPart = root or model.PrimaryPart
	end

	local Weld = Instance.new("WeldConstraint")
	for _, descendant in pairs(model:GetDescendants()) do
		if descendant:IsA("BasePart") then
			descendant.Size += Vector3.new(0.05, 0.05, 0.05)
			local touched = descendant:GetTouchingParts()
			
			for _, touch in pairs(touched) do
				local weld = Weld:Clone()
				weld.Part1 = touch
				weld.Part0 = descendant
				weld.Parent = descendant
			end
		end
	end
	Weld:Destroy()
	Weld = nil
end
2 Likes

I have a timer where the event is fired.And i create a placement system that will place an anchored part that part have a weld surface on all side and when the event if fired,The script called MakeJoints() on the model and unanchor all the part inside the model.And i cant use for loop since i also have wheel