Unbearable Pain in my Leg

Mai
This has been happening for about a month now. Every time I stretch my legs at least one leg is in complete pain. It hurts so much that I literally scream in pain and my parents always rush into my room worried. It kinda feels like something is being torn, but I can walk fine. But lately, it's been happening very often to the point where I'm scared to walk in case the pain comes back. I've tried to find a reason as to why this keeps happening. I exercise but my eating habits aren't the best?
Any idea on why this is happening? And how I'm able to prevent it?