--[[
	
	Welds part A to part B using a WeldConstraint (returns weld)
	
	Functions.Weld(
		partA,					<-- |REQ| 	Part instance
		partB,					<-- |REQ|	Part instance
		isManualWeld			<-- 		true = ManualWeld, false = WeldConstraint			[defaults to: false]
	)
	
--]]



return function(a, b, isManualWeld)
	--- Create weld
	local weld = Instance.new((isManualWeld and "ManualWeld" or "WeldConstraint"))
	
	--- Set part adornees
	weld.Part0 = a
	weld.Part1 = b
	
	--- If manual weld, set CFrame
	if isManualWeld then
		weld.C0 = a.CFrame:inverse() * b.CFrame
	end
	
	--- Part to part A
	weld.Parent = a
	
	--
	return weld
end
