Ive been playing guitar for about 3 years or so, but a thing i know i lack is songwriting and musical theory, i am self taught and my theory isnt the best

i need help with writing creative heavy songs.
bands that influence me are

impending doom
despised icon
SOME suicide silence
through the eyes of the dead (you get the idea)

everytime i try and write a song i end up improvising it and it sounds really unoriginal in my opinion, i undestand that you can write a song from a scale but i dont fully understand how to do it so if someone with experience with this music can help me and point me in the right direction to where i can get started and how to be more creative with my writing.