Bring the Children Only If He Gets a Reward
The passuk says (Devarim 3`1:12): "Hakhel es ha’am, gather the nation, the men, women and children," and the Gemara asks (Chagigah 3a): "We can understand why the men and women were gathered to teach and hear, but "why did the children come?" And the Gemara answers: "To give a reward to those who bring them." Tosafos there adds (ad loc. Kedei): "And it is upon this that they based bringing young children to the beis knesses."
Harav Menachem Di Lonzano wrote: A person should not bring his little children to shul unless they know how to be careful about the sanctity of the shul, and do not disturb the mispallelim. But someone whose children are lax about respecting the shul, and they act wild there, instead of the words "to give a reward to those who bring them" being applied, of him it will say "to punish those who bring them," chas veshalom. It is similar to someone who has an appointment in the king’s palace and he brings his foolish servant with him. This servant then embarrasses the king in front of many people. Of course the king would not punish the servant, who is not responsible for his actions, but rather, the master that brought him will be punished. Likewise, someone who brings a child who is not respectful to shul will be punished; the child who does not know better is not the one who will be punished (Shtei Yados, [Venice 5378] p. 117).
The Vayechi Yosef adds that these words are alluded to in the Gemara: The Gemara asks: "why were the children brought" – why did the passuk need to explicitly say that the children should be brought? If the men and women were commanded to come, surely they would not leave the children alone at home?
The Gemara answers: "To give a reward to those who bring them" – the passuk teaches us that one should only bring the children in a way that those who bring them will be rewarded, meaning, in order to be mechanech them to answer amen and other holy things. If, chalilah, their presence disturbs the mispallelim, the ones who brought them will be punished, and it is better that they should stay home (Vayechi Yosef, ibid p. 182).
