Macbook turns off whenever I unplug it and open an application
I noticed this yesterday and was concerned on what was happening, my battery was at 100% and i decided to open browser to play games like roblox, when the roblox app opened, my laptop froze and immediately shut down. I tried to manually turn it on but during the booting, it turned off again. I then plugged in my charger and it then finally turned back on normally but the battery percent was 10%, A message with title 'problem report' was displayed stating "your computer was restarted because of a problem." I then let it charge for a bit until it was at 100% but once i unplugged it, the issue happened again. I really hope there is a way to fix this as i can no longer use my laptop without it having to be plugged in
MacBook Air 13″, macOS 12.1