A writer may know what they want to happen in their script, but sometimes it doesn't work out that way. The characters might unexpectedly guide you in a different direction, or maybe you realize what the story really needs is to take a sharp turn off to the side, or you decide that this is the perfect opportunity to go in a totally opposite direction.
Nothing is set in stone. You're the ultimate creator. Everything that happens is under your control, and you can do with it what you will.
Something not working for you? Change it. Give yourself options.
Follow-up to that - go with options that still work within the context of the story and characters. Your characters still want the same thing they did before, but now you've drastically altered how they get there.
It's a savvy writer who eagerly anticipates taking on the task of devising these kinds of changes. And once they're all implemented, you'll barely remember how it used to be because EVERYTHING WORKS SO MUCH BETTER NOW.
Suggestion - no matter how or when you come up with a new idea, WRITE IT DOWN. IMMEDIATELY. Even if you're in the middle of working on the same script. Everybody says "Oh, I'll remember that later."
Do whatever you have to in order to preserve it.