How to stop repeating text on event?

I’m sure this is very simple to know, but I’m having a hard time figuring this out recently.

For the example of my issue, let’s say there’s a door that is locked. Text of the main character is saying that the door is locked and needs a key or key item to unlock it on the first page. And on the second page is the control variable that allows you access when you have gotten said key item.

I then realized that if you get the key item before interacting with the door at all the character will still say that it’s still locked and then say they have the key item and open it.

I’m not sure how to make her not say ,”The door is still locked, I need the key!” if the key item is already collected.
Could someone help explain how to fix this detail? I’m not completely experienced with RPG Maker and game making yet, so there’s a few little things that I tend to run into and have some trouble with.

Thank you.
You should post a picture of what you did, as that will make it easier to see why it is repeating.
As bgillisp said (and as it says in the section rules, you need to post actual screenshots of your event to get correct answers, rather than just describe them.

However:
And on the second page is the control variable that allows you access when you have gotten said key item.
How is the event getting to that second page? And why is it on a second page, and what does a control variable have to do with the price of tea in China?

All you need is a Conditional Branch that checks whether you have the key item - if yes, open the door, in the Else branch say it's still locked.
Here's an example of how you could set it up, and if you'd like some extended functionality for if you find the key before hand or if you'd only want the unlock sound to only play once.
You could use a second page but it's not really nececary unless you're changing stuff on the left, however some people would use one here to keep the code clean.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-stop-repeating-text-on-event.171878/