Custom weld missbehaving when part is resized

Hello!

I’ve written a custom weld in order to be able to weld the player character to anchored parts while preventing any desync issue caused by using normal welds due to the change in NetworkOwnership.

But if the part the character is welded to is resized, the character ends up floating in the air and I’ve been unable to find a solution.

self.connection = RunService.Heartbeat:Connect(function()
		if not self.part0 then return end
		
		if self.part0:IsA('Model') then
			if not self.part0.PrimaryPart then return end
			
			if self.part1 then
				self.part0:PivotTo(self.part1.CFrame * self.c1 * self.c0:Inverse())
			else
				self.part0:PivotTo(self.c0)
			end
			
			self.part0.PrimaryPart.AssemblyLinearVelocity = Vector3.zero
		else
			if self.part1 then
				self.part0.CFrame = self.part1.CFrame * self.c1 * self.c0:Inverse()
			else
				self.part0.CFrame = self.c0
			end
			
			self.part0.AssemblyLinearVelocity = Vector3.zero
		end
	end)

Would somebody have a solution to this? Thanks!