If you want to know how to write a script, you should have a firm idea of what it is you actually want to achieve. When it comes to writing, you should aim to create stories which you would want to read yourself. For example, one reason J.R.R Tolkien wrote was because nobody else was writing stories that he wanted to read.
While he specialized in short stories and novels, you could apply the same technique to screenwriting. Perhaps you have visualized a scene or heard a line of dialogue you know would work beautifully on screen. Or maybe you have a theme or setting you would love to see at the heart of a film, which no-one else has tried. In this case, why not write it yourself?
No doubt you will have watched movies in the past and told yourself that you could do better. Screenwriting can be easy to talk about but is difficult to do well. Whatever you do, you need to be sure that you are writing something you believe is worth your time. If you do not, then why should anyone else believe it is worth any of theirs?
As with most creative endeavors, you will learn how to write a script better the more you do. Of course, it will take a lot of time and effort to create a script which is up to scratch, but screenwriting should be something you enjoy. And the better you get, the more rewarding it will be.