All that we do is under the will of Allah. We should always strive to work hard and have trust in Allah that our hard work will pay off.
We should not be too disheartened when things don't to according to plan if we tried our best. Often disappointment and dwelling too much on it can lead to a negative impact on ones mental well-being. It can also encourage a negative environment for those around us.
Negative vibes breed more negative vibes.
Teach your children to rely on Allah after putting the work in. Teach them to accept the outcome even if it is not the one they intended. They can learn from anything that didn't go according to plan and turn a negative result into a positive impact, by growing and developing. Next time they try to do the same thing, they can implement what they've learnt previously and inshā'Allāh be successful!