The point of emotions

My understanding is the reason we have emotions is to drive our actions. With some emotions this makes sense i.e. determined, enthusiastic, but it’s less clear to me why we experience other emotions such as guilt or resentment?

Is there a particular purpose to all of of our emotions? I can see how fear has evolved from our primitive ancestors and how we experience that fear in our modern brain/world. I’m less sure how other emotions are actually useful to us , other than they make up the human experience and are part of the 50/50. But again I question the point of experiencing them (inadequacy, guilt, confused etc) how do they help us?

I’d love your thoughts on this.