If you are sharing an Apple ID (which should not be done, for many reasons), Apple Music will work on up to 10 devices using that Apple ID, but not at the same time.
i.e only one device can play music from Apple Music at any one time. If Another device starts playing music, the previous one will stop playing.
Each person should have their own Apple ID. They should not for any reason be shared. This can lead to messages, calls and contacts be merged and be a nightmare to sort. As well as having iCloud contents getting mixed up.
To use the Apple Music Family Plan, each family group member must have their own Apple ID. Then you can play on more than one device at a time as long as each device is logged in to a different Apple ID.
Read here for more:
Get an Apple Music Family subscription - Apple Support
Set up Family Sharing - Apple Support