There is a scene in 21 Jump Street (the movie, not the show) that is one of my favorites. It's where Schmidt and Jenko, our heroes, are getting berated for losing their arrest because they failed read the Miranda Rights. Or as Deputy Chief Hardy says, "The only thing you have to do when arresting someone". It's a great scene. I love it. It's pitch perfect, it's comical and it propels the story along. It's also completely untrue. There is a myth about the Miranda Rights that is prevalent in society and pop culture. It's so prevalent that I don't know if people believe it because they see it in movies or if it's in movies because everybody believes it. So let's dispel the myth.
There is actually no set wording to the Miranda Rights, but in popular culture you will usually hear:
You have the right to remain silent
You have the right to an attorney
If you cannot afford an attorney, one will be provided for you.
There are some minor variations that specific states require.
Now, when do Miranda Rights have to be read? They must be read when a suspect is in custody (a reasonable person believes they are not allowed to leave) AND they are going to be asked questions that the police or prosecution want to use in trial. I arrested dozens of people in my career, never once did I read them their Miranda Rights. In fact, my boss laughed at me on my first arrest when I asked when we read the Miranda Rights. The reason I didn't read them is because I had no intention of questioning them. Most of these arrests were on outstanding warrants. I don't have any questions there. This is your warrant and you are definitely you. Head directly to jail. Do not pass go. Do not collect $200.
We had another man who had a book written by a child psychologist. The book was a clinical evaluation of the mind of a child predator. In the margins of the book the man had written a whole bunch of annotations like, "That's not true, we're not like that" or, "Totally false!" Then, in the blank pages in the back of the book, he had a lengthy written confession of what it truly meant to be a child predator. Couple that with the child porn images we found and we had him fitted in handcuffs and on the way to a free stay in the Grey Bar Hotel (after a call to the US Attorney to get the formal charges, of course). At no time did we read him his rights. I didn't really have any questions that I wanted to hear his thoughts on anyway. His rights would be read to him when an agent or prosecutor sat down with him later to sort out everything we had found. That is the point where he can't leave AND he was being asked questions pertinent to trial.
So what happened in between where we arrested him and when he was finally sat down for interrogation? That is the grey area that usually mucks up cases. Again, the key is being asked questions pertinent to the case. When he was being transported to the detention center he could have confessed further. If the officer was concerned about the comfort in the backseat and asked, "Are you doing OK back there?" and he responded, "No, I just came to grips with the fact that I've raped dozens of children" it's totally admissible. But, if the officer asked "Do you really rape children?" and he answered, "Yes, dozens of them." it would not be allowed in court, because he had not been read his rights at that point. The correct legal term for that is "Fruit of the Poisonous Tree".
Admittedly, this a very high level overview. There are always exceptions and subsections to everything wherever the law is concerned. But I think GI Joe said it best, "Now you know, and knowing is half the battle."
How does this relate to your scripts? The answer is, it depends. Going back to 21 Jump Street, yes, that scene was wrong. But it's a comedy movie. They are allowed to get away with sillier things. In the grand scheme of things, it doesn't really have that big of impact on the movie and it was wickedly funny. But if you are writing a serious drama and a Miranda Rights failure is a key cog in your script, that is a lot harder to overcome.
Did I just age myself with that GI Joe reference?