I was learning rigging using this tutorial https://www.youtube.com/watch?v=Q9f-WVs3ghI , but when I add automated weights to the mesh and move its head hat stays in the same place . why does it happen ? all mesh parts are joined together . did I do something wrong /miss something ?
This is actually quite simple, you just didn't add weight on the hat
As you can see, the hat has 0 weight, the amount of weight it has is how much influence the bone has on that part of the mesh
Here I set the weight on the hat to 1 (Max influence) so the head bone has 100% control over the hat, an easy way to add the weight to individual objects is to separate them in edit mode using "P" then select "Loose parts", I don't like to have all objects joined in one single mesh because that complicates things when doing weight painting or other stuff involving rigging
so there you go!, just set the hat weight to 1 and that's it, easy cake :)