I could do this in Word very easily -- Short Version: Create a Style called "Character Name" Indicate that the style "Dialogue" is what follows next. (that's on the first area of the create-a-style dialogue). Then in the PARAGRAPHS section of that Character Name Style, the second/advanced tab, choose "Keep-with-next"
I do most of my editing in drafts-view, because it's easy to see in the left pane which template is being used, and to remember to make changes via Style, not direct-formatting.
A sequence of 11 pictures.
Drafts View, "no" styles
1) I copied some lyrics to be my "script". I chose View, Draft, to create that left-view. Shift-F1 is another great tool for knowing layout.
Create A Style
2) I manually centered one line, then selected it as my "model" - then on the Styles Menu, I chose Create-A-Style to get started
Name the Style & Start to Modify
3)You can give any style any name. You can also change more properties within this.
Styles That Can Be Buddies
4)Most of the time, after a Character Name, there's dialog - so I previously made that style (Normal, but indented .5" on L & R, smaller space before/after paragraphs.) So you can select a "Next Style" button as shown here, and then use the Modify button at the bottom, to see various other elements to change.
5) In the Modify box, you can go to many areas - you may want to add a Shortcut Key so you can turn on Character Name formatting at the start of said line! We want to do paragraph options now
Paragraph Options, 2nd Tab
6) The big feature you want is "Keep with Next" (You may want to also have Scene Breaks start a new page - use "Page Break Before" then.)
7) Hey, there are our Styles in the gallery!
8) Screenshot of the script, now with those character and dialog Styles added. Note there's a page break here -- I played with adding blocks of text - the character-name stayed with the dialog! (But Things seem a little unbalanced, hmmmm...)
Modify Style Even More
9) So let's fix that spacing issue -- too little space between blocks and the next character name. (It's nice to know that once a style exists, it can still be modified as needed)
Back to Style Paragraphs
10) Just the front part, playing with spacing instead of adding unneeded "enter"s to add spaces
If most of what you write are plays, then you can add these Styles to your Normal.dotm template -- if not, save a template (File, Save-As, choose "file-type as .dotx or .dotm, then name it) for all playwriting styles.
(Note - my font styles are Arial since that's work normal -- feel free to change. And the source of my "dialogue" is a song going through my head from Heathers
(lyrics from https://genius.com/Laurence-okeefe-and-kevin-murphy-dead-girl-walking-lyrics